Allow reselecting currently selected favourite

This commit is contained in:
Mark Watkins 2011-12-26 14:58:02 +10:00
parent ebc363b4c6
commit 44c83da8e5
3 changed files with 20 additions and 1 deletions

View File

@ -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()

View File

@ -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();
}
}
}

View File

@ -257,6 +257,8 @@ private slots:
void on_favouritesList_itemSelectionChanged();
void on_favouritesList_itemClicked(QListWidgetItem *item);
private:
Ui::MainWindow *ui;