Clean up yearly statistics

Remove the unused upper widget, set a somewhat random but at least more
reasonable default size and finally support Ctrl-W and Ctrl-Q shortcuts.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-11-17 18:19:51 +00:00
parent d5d7fdc9af
commit f5bea8fcfd

View file

@ -552,14 +552,16 @@ void MainWindow::on_actionAutoGroup_triggered()
void MainWindow::on_actionYearlyStatistics_triggered()
{
QDialog d;
YearlyStatisticsWidget *newView = new YearlyStatisticsWidget();
QVBoxLayout *l = new QVBoxLayout(&d);
l->addWidget(newView);
YearlyStatisticsModel *m = new YearlyStatisticsModel();
QTreeView *view = new QTreeView();
view->setModel(m);
newView->setModel(m);
l->addWidget(view);
d.resize(width() * .8, height() / 2);
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), &d);
connect(close, SIGNAL(activated()), &d, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), &d);
connect(quit, SIGNAL(activated()), this, SLOT(close()));
d.exec();
}