aboutsummaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_qt3support_widgets_q3mainwindow.cpp
blob: c63b481d9c6be11d6d425a20505e30a04f791dd0 (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
//! [0]
Q3MainWindow *mw = new Q3MainWindow;
QTextEdit *edit = new QTextEdit(mw, "editor");
edit->setFocus();
mw->setWindowTitle("Main Window");
mw->setCentralWidget(edit);
mw->show();
//! [0]


//! [1]
Q3ToolBar *tb = new Q3ToolBar(this);
addDockWindow(tb, tr("Menubar"), Top, false);
QMenuBar *mb = new QMenuBar(tb);
mb->setFrameStyle(QFrame::NoFrame);
tb->setStretchableWidget(mb);
setDockEnabled(tb, Left, false);
setDockEnabled(tb, Right, false);
//! [1]


//! [2]
QFile file(filename);
if (file.open(IO_WriteOnly)) {
    QTextStream stream(&file);
    stream << *mainWindow;
    file.close();
}
//! [2]


//! [3]
QFile file(filename);
if (file.open(IO_ReadOnly)) {
    QTextStream stream(&file);
    stream >> *mainWindow;
    file.close();
}
//! [3]


//! [4]
Q3PopupMenu * help = new Q3PopupMenu(this);
help->insertItem("What's &This", this , SLOT(enterWhatsThis()), Qt::SHIFT+Qt::Key_F1);
//! [4]