diff --git a/daily.cpp b/daily.cpp index 04842db2..d63ee840 100644 --- a/daily.cpp +++ b/daily.cpp @@ -532,8 +532,10 @@ void Daily::UpdateCalendarDay(QDate date) } void Daily::LoadDate(QDate date) { + ui->calendar->blockSignals(true); ui->calendar->setSelectedDate(date); - // on_calendar_selectionChanged(); + ui->calendar->blockSignals(false); + on_calendar_selectionChanged(); } void Daily::on_calendar_selectionChanged() diff --git a/mainwindow.cpp b/mainwindow.cpp index 4a5bf1c9..d26a4d13 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1022,6 +1022,7 @@ void MainWindow::on_summaryButton_clicked() } void MainWindow::updateFavourites() { + ui->favouritesList->blockSignals(true); ui->favouritesList->clear(); QDate date=PROFILE.LastDay(); @@ -1046,6 +1047,7 @@ void MainWindow::updateFavourites() date=date.addDays(-1); } while (date>=PROFILE.FirstDay()); + ui->favouritesList->blockSignals(false); } void MainWindow::on_backButton_clicked() @@ -2082,3 +2084,16 @@ void MainWindow::on_favouritesList_itemSelectionChanged() ui->tabWidget->setCurrentWidget(daily); } } + +void MainWindow::on_favouritesList_itemClicked(QListWidgetItem *item) +{ + if (!item) return; + QDate date=item->data(Qt::UserRole).toDate(); + if (date.isValid()) { + if (date==daily->getDate()) { + ui->tabWidget->setCurrentWidget(daily); + daily->graphView()->ResetBounds(); + daily->graphView()->redraw(); + } + } +} diff --git a/mainwindow.h b/mainwindow.h index 373679c3..750859c5 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -257,6 +257,8 @@ private slots: void on_favouritesList_itemSelectionChanged(); + void on_favouritesList_itemClicked(QListWidgetItem *item); + private: Ui::MainWindow *ui;