Ignore:
Timestamp:
01/19/10 10:45:59 (12 years ago)
Author:
fortefr <fortefr@…>
Branches:
master, qt5
Children:
ec67a0b
Parents:
9afc0ee
Message:

Automatic tabs update

M src/gui/mainwindow.ui
M src/gui/mainwindow.cpp
M src/gui/mainwindow.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/mainwindow.cpp

    r9afc0ee rc5324ca  
    3939    connect(dayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateDayView(const QDate &)));
    4040    connect(activityDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateActivitiesDayView(const QDate &)));
    41     //connect(tabWidget, SIGNAL(currentChanged(int)), SLOT(updateView(int)));
    4241
    4342    // DAY EVENTS View
     
    9695        activityDayNavigator->setDates(aStartDate, aEndDate);
    9796    }
    98     connect(static_cast<EventModel*>(dayTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavView()));
    99     connect(static_cast<EventModel*>(favTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavView()));
    100 /*    connect(static_cast<EventModel*>(favTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavViewComplete()));*/
     97
     98    connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTab(int)));
     99
    101100}
    102101
     
    152151}
    153152
    154 void MainWindow::updateDayView(const QDate &aDate)
     153void MainWindow::updateDayView(const QDate aDate)
    155154{
    156155    int confId = 1;
    157     static_cast<EventModel*>(dayTreeView->model())->loadEvents(aDate,confId);
     156    static_cast<EventModel*>(dayTreeView->model())->loadEvents(Conference::getById(confId).start(),confId);
    158157    dayTreeView->reset();
    159158    dayNavigator->show();
    160159}
    161160
    162 void MainWindow::updateFavView()
     161void MainWindow::updateTab(const int n)
    163162{
    164163    int confId = 1;
    165     static_cast<EventModel*>(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId);
    166     favTreeView->reset(); //Necessary reset:
    167                         //  if favourite event unselected as favourite is the only one in its time, and reset is not produced, crashed
    168 
     164    if(n) //index 1 of tabWidget: favouriteTab
     165    {
     166        static_cast<EventModel*>(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId);
     167        favTreeView->reset();
     168    }
     169    else //index 0 of tabWidget: dayViewTab
     170    {
     171        static_cast<EventModel*>(dayTreeView->model())->loadEvents(Conference::getById(confId).start(),confId);
     172        dayTreeView->reset();
     173    }
     174    //TODO: update of activitiesTab needed?
    169175    dayNavigator->show();
    170176}
    171177
    172 /*
    173 void MainWindow::updateFavViewComplete()
    174 {
    175     int confId = 1;
    176     updateFavView();
    177     updateDayView(Conference::getById(confId).start());
    178 }
    179 */
    180178
    181179void MainWindow::updateActivitiesDayView(const QDate &aDate)
Note: See TracChangeset for help on using the changeset viewer.