8MainWindow::MainWindow()
16void MainWindow::createMenus()
19 QMenu *menu =
new QMenu(
"File");
20 menu->addAction(
"Save &As");
22 QMenuBar *bar =
new QMenuBar;
25 setMenuWidget(
new QWidget());
28void MainWindow::createToolBars()
30 setToolButtonStyle(Qt::ToolButtonTextOnly);
31 QToolBar *t1 =
new QToolBar;
32 t1->addAction(
new QAction(
"t1",
this));
34 QToolBar *t2 =
new QToolBar;
35 t2->addAction(
new QAction(
"t2",
this));
37 addToolBar(Qt::LeftToolBarArea, t1);
38 addToolBar(Qt::LeftToolBarArea, t2);
41void MainWindow::createDockWidgets()
43 QWidget *dockWidgetContents =
new QWidget;
44 QVBoxLayout *layout =
new QVBoxLayout(dockWidgetContents);
45 layout->addWidget(
new QPushButton(
"My Button."));
48 QDockWidget *dockWidget =
new QDockWidget(tr(
"Dock Widget"),
this);
49 dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea |
50 Qt::RightDockWidgetArea);
51 dockWidget->setWidget(dockWidgetContents);
52 addDockWidget(Qt::LeftDockWidgetArea, dockWidget);