-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
63 lines (40 loc) · 1.25 KB
/
mainwindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "mainwindow.h"
#include <QAction>
#include <QMenuBar>
#include <QStatusBar>
MainWindow::MainWindow(QWidget * parent)
: QMainWindow(parent)
{
setWindowTitle("Basic Application");
setMinimumSize(800, 450);
QMenuBar * menuBar = new QMenuBar(this);
setMenuBar(menuBar);
QMenu * menu = menuBar->addMenu("&File");
QAction * action = new QAction("&New", this);
connect(action, &QAction::triggered, this, &MainWindow::OnFileNew);
menu->addAction(action);
action = new QAction("&Open", this);
connect(action, &QAction::triggered, this, &MainWindow::OnFileOpen);
menu->addAction(action);
action = new QAction("&Save", this);
connect(action, &QAction::triggered, this, &MainWindow::OnFileSave);
menu->addAction(action);
menu->addSeparator();
action = new QAction("&Exit", this);
connect(action, &QAction::triggered, this, &MainWindow::close);
menu->addAction(action);
QStatusBar * statusBar = new QStatusBar(this);
setStatusBar(statusBar);
}
void MainWindow::OnFileNew()
{
statusBar()->showMessage("File -> New");
}
void MainWindow::OnFileOpen()
{
statusBar()->showMessage("File -> Open");
}
void MainWindow::OnFileSave()
{
statusBar()->showMessage("File -> Save");
}