Adding quit action to file menu
This commit is contained in:
parent
8239cb87b7
commit
26a0a6eaf2
1 changed files with 7 additions and 0 deletions
|
@ -21,8 +21,15 @@ Window::Window(QWidget *parent) :
|
||||||
open_action->setShortcut(QKeySequence::Open);
|
open_action->setShortcut(QKeySequence::Open);
|
||||||
QObject::connect(open_action, SIGNAL(triggered()),
|
QObject::connect(open_action, SIGNAL(triggered()),
|
||||||
this, SLOT(on_open()));
|
this, SLOT(on_open()));
|
||||||
|
|
||||||
|
QAction* quit_action = new QAction("Quit", this);
|
||||||
|
quit_action->setShortcut(QKeySequence::Quit);
|
||||||
|
QObject::connect(quit_action, SIGNAL(triggered()),
|
||||||
|
this, SLOT(close()));
|
||||||
|
|
||||||
auto file_menu = menuBar()->addMenu("File");
|
auto file_menu = menuBar()->addMenu("File");
|
||||||
file_menu->addAction(open_action);
|
file_menu->addAction(open_action);
|
||||||
|
file_menu->addAction(quit_action);
|
||||||
|
|
||||||
resize(600, 400);
|
resize(600, 400);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue