-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
77 lines (60 loc) · 2.06 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <mainwindow.h>
MainWindow::MainWindow()
{
createActions();
createMenus();
createToolBar();
createCentralZone();
resize(800,500);
}
void MainWindow::createActions()
{
// Create the QActions
previousPageAction = new QAction("Go &back", this);
previousPageAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Left));
previousPageAction->setIcon(QIcon("prec.png"));
nextPageAction = new QAction("Go &back", this);
nextPageAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Right));
nextPageAction->setIcon(QIcon("suiv.png"));
stopAction = new QAction("Stop", this);
stopAction->setIcon(QIcon("stop.png"));
refreshAction = new QAction("Refresh", this);
refreshAction->setIcon(QIcon("actu.png"));
homeAction = new QAction("Go &home", this);
homeAction->setIcon(QIcon("home.png"));
loadAction = new QAction("Load", this);
loadAction->setIcon(QIcon("go.png"));
quitAction = new QAction("Quit", this);
// Connect the QActions
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
}
void MainWindow::createMenus()
{
QMenu *fileMenu = menuBar()->addMenu("&File");
QMenu *navigationMenu = menuBar()->addMenu("&Navigation");
QMenu *aboutMenu = menuBar()->addMenu("&?");
fileMenu->addAction(quitAction);
navigationMenu->addAction(previousPageAction);
navigationMenu->addAction(nextPageAction);
navigationMenu->addAction(stopAction);
navigationMenu->addAction(refreshAction);
navigationMenu->addAction(homeAction);
navigationMenu->addAction(loadAction);
}
void MainWindow::createToolBar()
{
QToolBar *toolBar = addToolBar("Toolbar");
urlLineEdit = new QLineEdit;
toolBar->addAction(previousPageAction);
toolBar->addAction(nextPageAction);
toolBar->addAction(stopAction);
toolBar->addAction(refreshAction);
toolBar->addAction(homeAction);
toolBar->addWidget(urlLineEdit);
toolBar->addAction(loadAction);
}
void MainWindow::createCentralZone()
{
QWidget *centralZone = new QWidget;
setCentralWidget(centralZone);
}