blob: 9e81fd15c5b1b31b6788d2a9b2dd5be57654d1a8 (
plain)
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
|
//! [0]
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
//! [0]
//! [1]
fileToolbar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
addToolBar(Qt::TopToolBarArea, fileToolbar);
//! [1]
//! [2]
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
//! [2]
//! [3]
QWidget *centralWidget = new QWidget(this);
setCentralWidget(centralWidget);
//! [3]
//! [4]
QPopupMenu *fileMenu = new QPopupMenu(this);
openAction->addTo(fileMenu);
saveAction->addTo(fileMenu);
...
menuBar()->insertItem(tr("&File"), fileMenu);
//! [4]
//! [5]
QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(openAction);
fileMenu->addAction(saveAction);
...
//! [5]
//! [6]
QToolBar *fileTools = new QToolBar(this, "file toolbar");
openAction->addTo(fileTools);
saveAction->addTo(fileTools);
...
//! [6]
//! [7]
QToolBar *fileTools = addToolBar(tr("File Tool Bar"));
fileTools->addAction(openAction);
fileTools->addAction(saveAction);
...
//! [7]
//! [8]
QDockWidget *dockWidget = new QDockWidget(this);
mainWin->moveDockWidget(dockWidget, Qt::DockLeft);
//! [8]
//! [9]
QDockWidget *dockWidget = new QDockWidget(mainWindow);
mainWindow->addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
//! [9]
|