]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/gui/mainwindow.cpp
Favourites fix
[toast/confclerk.git] / src / gui / mainwindow.cpp
index 574735683049c273419dccb84b2cd1472e42a573..0ab7bd5583279ca98d8d033942e460ba8bbe3e1c 100644 (file)
@@ -69,7 +69,7 @@ MainWindow::MainWindow(QWidget *parent)
     }
 
     connect(static_cast<EventModel*>(dayTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavView()));
-    connect(static_cast<EventModel*>(favTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavView()));
+    connect(static_cast<EventModel*>(favTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavViewComplete()));
 }
 
 MainWindow::~MainWindow()
@@ -134,6 +134,13 @@ void MainWindow::updateFavView()
 {
     int confId = 1;
     static_cast<EventModel*>(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId);
-    favTreeView->reset();
+    favTreeView->reset(); //Necessary reset:
+                        //  if favourite event unselected as favourite is the only one in its time, and reset is not produced, crashed
+}
+
+void MainWindow::updateFavViewComplete()
+{
+    int confId = 1;
+    updateFavView();
     updateDayView(Conference::getById(confId).start());
 }