summaryrefslogtreecommitdiffstats
path: root/examples/widgets/doc/src/dynamiclayouts.qdoc
blob: 0b9d43c98ea6eac8642e0b8a0b066fa71101733b (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \example layouts/dynamiclayouts
    \title Dynamic Layouts Example
    \brief Shows how to re-orient widgets in running applications.

    \e{Dynamic Layouts} implements dynamically placed widgets within running
    applications. The widget placement depends on whether \c Horizontal or \c
    Vertical is chosen.

    \borderedimage dynamiclayouts-example.png
    For more information, visit the \l{Layout Management} page.

    \section1 Dialog Constructor

    To begin with, the application creates the UI components by calling the
    following methods:

    \list
    \li createRotatableGroupBox()
    \li createOptionsGroupBox()
    \li createButtonBox()
    \endlist

    It then adds the UI components to a GridLayout (\c mainLayout).

    Finally, \c Dialog::rotateWidgets() is called.

    \quotefromfile layouts/dynamiclayouts/dialog.cpp
    \skipuntil createRotatableGroupBox
    \printuntil setWindowTitle

    \section1 Creating the Main Widgets

    The \c createRotatableGroupBox() method creates a rotatable group box,
    then adds a series of widgets:

    \list
    \li QSpinBox
    \li QSlider
    \li QDial
    \li QProgressBar
    \endlist

    It goes on to add signals and slots to each widget, and assigns
    a QGridLayout called \a rotatableLayout.

    \skipto Dialog::createRotatableGroupBox
    \printuntil /^\}/

    \section1 Adding Options

    \c createOptionsGroupBox() creates the following widgets:
    \list
    \li \c optionsGroupBox
    \li \c buttonsOrientationLabel
    \li \c buttonsOrientationComboBox. The orientation of the ComboBox is either
           \c horizontal (default value) or \c vertical. These two values
           are added during the startup of the application. It is not possible
           to leave the option empty.
    \endlist

    \skipto Dialog::createOptionsGroupBox()
    \printuntil /^\}/

    \section1 Adding Buttons

    createButtonBox() constructs a QDialogButtonBox called \c buttonBox
    to which are added a \c closeButton, a \c helpButton and a
    \c rotateWidgetsButton.
    It then assigns a signal and a slot to each button in \c buttonBox.

    \skipto Dialog::createButtonBox()
    \printuntil /^\}/


    \section1 Rotating the Widgets

    Removes the current widgets and activates the next widget.

    \quotefromfile layouts/dynamiclayouts/dialog.cpp
    \skipto Dialog::rotateWidgets()
    \printuntil rotatableLayout->addWidget(rotatableWidgets[i]
    \printuntil }
    \printuntil }

    \include examples-run.qdocinc
*/