From 9e498651bb94cd01df50f95cdac66436ba921cd6 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 25 Nov 2014 11:23:00 +0100 Subject: [PATCH] WIP: tmp for QTBUG-42242 Change-Id: Idbdd97eb9d9ded4e99dc1e259202c14de9b8258b --- examples/widgets/mainwindows/application/mainwindow.cpp | 6 ++++++ examples/widgets/mainwindows/application/mainwindow.h | 1 + 2 files changed, 7 insertions(+) diff --git a/examples/widgets/mainwindows/application/mainwindow.cpp b/examples/widgets/mainwindows/application/mainwindow.cpp index dd87519..33db0a1 100644 --- a/examples/widgets/mainwindows/application/mainwindow.cpp +++ b/examples/widgets/mainwindows/application/mainwindow.cpp @@ -176,6 +176,11 @@ void MainWindow::createActions() saveAsAct->setStatusTip(tr("Save the document under a new name")); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); + closeAct = new QAction(tr("Close window"), this); + closeAct->setShortcuts(QKeySequence::Close); + closeAct->setStatusTip(tr("Close the window")); + connect(closeAct, SIGNAL(triggered()), this, SLOT(close())); + //! [20] exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcuts(QKeySequence::Quit); @@ -236,6 +241,7 @@ void MainWindow::createMenus() fileMenu->addAction(saveAct); //! [26] fileMenu->addAction(saveAsAct); + fileMenu->addAction(closeAct); fileMenu->addSeparator(); fileMenu->addAction(exitAct); diff --git a/examples/widgets/mainwindows/application/mainwindow.h b/examples/widgets/mainwindows/application/mainwindow.h index 828db44..e447b32 100644 --- a/examples/widgets/mainwindows/application/mainwindow.h +++ b/examples/widgets/mainwindows/application/mainwindow.h @@ -93,6 +93,7 @@ private: QAction *openAct; QAction *saveAct; QAction *saveAsAct; + QAction *closeAct; QAction *exitAct; QAction *cutAct; QAction *copyAct; -- 2.1.2