Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
mdiareasnippets.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QtWidgets>
5
7{
8 QMdiArea *mdiArea = new QMdiArea;
9
10 //! [0]
11 QMainWindow *mainWindow = new QMainWindow;
12 mainWindow->setCentralWidget(mdiArea);
13 //! [0]
14
15 mdiArea->addSubWindow(new QPushButton("Push Me Now!"));
16
17 mainWindow->show();
18}
19
21{
22 QWidget *internalWidget1 = new QWidget;
23 QWidget *internalWidget2 = new QWidget;
24
25 //! [1]
26 QMdiArea mdiArea;
27 QMdiSubWindow *subWindow1 = new QMdiSubWindow;
28 subWindow1->setWidget(internalWidget1);
29 subWindow1->setAttribute(Qt::WA_DeleteOnClose);
30 mdiArea.addSubWindow(subWindow1);
31
32 QMdiSubWindow *subWindow2 =
33 mdiArea.addSubWindow(internalWidget2);
34
35 //! [1]
36 subWindow1->show();
37 subWindow2->show();
38
39 mdiArea.show();
40}
void addingSubWindowsExample()
void mainWindowExample()