From 56ad3ab910de5679cba6f110d287e8bad9ecc5cf Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 2 Oct 2018 00:53:28 +0200 Subject: [PATCH] Hook up the exit menu. --- mainwindow.cpp | 8 ++++++++ mainwindow.h | 1 + ui_mainwindow.ui | 6 +++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 9d09582..b6ac8bf 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -35,6 +35,9 @@ MainWindow::MainWindow() global_mainwindow = this; ui->setupUi(this); + // The menus. + connect(ui->exit_action, &QAction::triggered, this, &MainWindow::exit_triggered); + global_disk_space_estimator = new DiskSpaceEstimator(bind(&MainWindow::report_disk_space, this, _1, _2)); disk_free_label = new QLabel(this); disk_free_label->setStyleSheet("QLabel {padding-right: 5px;}"); @@ -631,3 +634,8 @@ void MainWindow::report_disk_space(off_t free_bytes, double estimated_seconds_le }); } +void MainWindow::exit_triggered() +{ + close(); +} + diff --git a/mainwindow.h b/mainwindow.h index 679feb9..35898a7 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -87,6 +87,7 @@ private: bool eventFilter(QObject *watched, QEvent *event) override; void report_disk_space(off_t free_bytes, double estimated_seconds_left); + void exit_triggered(); private slots: void relayout(); diff --git a/ui_mainwindow.ui b/ui_mainwindow.ui index 5b0021a..a0aa47b 100644 --- a/ui_mainwindow.ui +++ b/ui_mainwindow.ui @@ -328,13 +328,13 @@ &File - + - + - Quit + E&xit -- 2.39.2