[556] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
[846] | 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[556] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
| 6 | **
|
---|
| 7 | ** This file is part of the documentation of the Qt Toolkit.
|
---|
| 8 | **
|
---|
[846] | 9 | ** $QT_BEGIN_LICENSE:FDL$
|
---|
[556] | 10 | ** Commercial Usage
|
---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
[846] | 13 | ** Software or, alternatively, in accordance with the terms contained in a
|
---|
| 14 | ** written agreement between you and Nokia.
|
---|
[556] | 15 | **
|
---|
[846] | 16 | ** GNU Free Documentation License
|
---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Free
|
---|
| 18 | ** Documentation License version 1.3 as published by the Free Software
|
---|
| 19 | ** Foundation and appearing in the file included in the packaging of this
|
---|
| 20 | ** file.
|
---|
[556] | 21 | **
|
---|
| 22 | ** If you have questions regarding the use of this file, please contact
|
---|
| 23 | ** Nokia at qt-info@nokia.com.
|
---|
| 24 | ** $QT_END_LICENSE$
|
---|
| 25 | **
|
---|
| 26 | ****************************************************************************/
|
---|
| 27 |
|
---|
| 28 | /*!
|
---|
[846] | 29 | \page widgets-and-layouts.html
|
---|
| 30 | \title Widgets and Layouts
|
---|
| 31 | \ingroup qt-gui-concepts
|
---|
| 32 | \brief The primary elements for designing user interfaces in Qt.
|
---|
[556] | 33 |
|
---|
[846] | 34 | \section1 Widgets
|
---|
[556] | 35 |
|
---|
[846] | 36 | Widgets are the primary elements for creating user interfaces in Qt.
|
---|
| 37 | \l{The Widget Classes}{Widgets} can display data and status information,
|
---|
| 38 | receive user input, and provide a container for other widgets that
|
---|
| 39 | should be grouped together. A widget that is not embedded in a
|
---|
| 40 | parent widget is called a \l{Window and Dialog Widgets} {window}.
|
---|
[556] | 41 |
|
---|
[846] | 42 | \image parent-child-widgets.png A parent widget containing various child widgets.
|
---|
[556] | 43 |
|
---|
[846] | 44 | The QWidget class provides the basic capability to render to the
|
---|
| 45 | screen, and to handle user input events. All UI elements that Qt
|
---|
| 46 | provides are either subclasses of QWidget, or are used in connection
|
---|
| 47 | with a QWidget subclass. Creating custom widgets is done by
|
---|
| 48 | subclassing QWidget or a suitable subclass and reimplementing the
|
---|
| 49 | virtual event handlers.
|
---|
[556] | 50 |
|
---|
[846] | 51 | \section1 Layouts
|
---|
[556] | 52 |
|
---|
[846] | 53 | \l{Layout Management}{Layouts} are an elegant and flexible way to
|
---|
| 54 | automatically arrange child widgets within their container. Each
|
---|
| 55 | widget reports its size requirements to the layout through the
|
---|
| 56 | \l{QWidget::}{sizeHint} and \l{QWidget::}{sizePolicy} properties,
|
---|
| 57 | and the layout distributes the available space accordingly.
|
---|
[556] | 58 |
|
---|
[846] | 59 | \table
|
---|
| 60 | \row
|
---|
| 61 | \o \image qgridlayout-with-5-children.png
|
---|
| 62 | \o \image qformlayout-with-6-children.png
|
---|
| 63 | \endtable
|
---|
[556] | 64 |
|
---|
[846] | 65 | \l{Qt Designer Manual}{\QD} is a powerful tool for interactively creating and
|
---|
| 66 | arranging widgets in layouts.
|
---|
[556] | 67 |
|
---|
[846] | 68 | \section1 Widget Styles
|
---|
[556] | 69 |
|
---|
[846] | 70 | \l{Styles and Style Aware Widgets}{Styles} draw on behalf of
|
---|
| 71 | widgets and encapsulate the look and feel of a GUI. Qt's built-in
|
---|
| 72 | widgets use the QStyle class to perform nearly all of their drawing,
|
---|
| 73 | ensuring that they look exactly like the equivalent native widgets.
|
---|
[556] | 74 |
|
---|
[846] | 75 | \table
|
---|
| 76 | \row
|
---|
| 77 | \o \image windowsxp-tabwidget.png
|
---|
| 78 | \o \image plastique-tabwidget.png
|
---|
| 79 | \o \image macintosh-tabwidget.png
|
---|
| 80 | \endtable
|
---|
[556] | 81 |
|
---|
[846] | 82 | \l{Qt Style Sheets} are a powerful mechanism that allows you to customize the
|
---|
| 83 | appearance of widgets, in addition to what is already possible by subclassing QStyle.
|
---|
[556] | 84 |
|
---|
[846] | 85 | \section1 The Widget Classes
|
---|
[556] | 86 |
|
---|
[846] | 87 | The following sections list the widget classes. See the \l{Qt Widget
|
---|
| 88 | Gallery} for some examples.
|
---|
[556] | 89 |
|
---|
[846] | 90 | \section2 Basic Widgets
|
---|
[556] | 91 |
|
---|
[846] | 92 | These basic widgets (controls), e.g. buttons, comboboxes and
|
---|
| 93 | scroll bars, are designed for direct use.
|
---|
[556] | 94 |
|
---|
[846] | 95 | \table
|
---|
| 96 | \row
|
---|
| 97 | \o \image windows-label.png
|
---|
| 98 | \o \image windowsvista-pushbutton.png
|
---|
| 99 | \o \image gtk-progressbar.png
|
---|
| 100 | \row
|
---|
| 101 | \o \image plastique-combobox.png
|
---|
| 102 | \o \image macintosh-radiobutton.png
|
---|
| 103 | \o \image cde-lineedit.png
|
---|
| 104 | \endtable
|
---|
[556] | 105 |
|
---|
[846] | 106 | \annotatedlist basicwidgets
|
---|
[556] | 107 |
|
---|
[846] | 108 | \section2 Advanced Widgets
|
---|
[556] | 109 |
|
---|
[846] | 110 | Advanced GUI widgets, e.g. tab widgets and progress bars, provide
|
---|
| 111 | more complex user interface controls.
|
---|
[556] | 112 |
|
---|
[846] | 113 | \table
|
---|
| 114 | \row
|
---|
| 115 | \o \image windowsxp-treeview.png
|
---|
| 116 | \o \image gtk-calendarwidget.png
|
---|
| 117 | \o \image qundoview.png
|
---|
| 118 | \endtable
|
---|
[556] | 119 |
|
---|
[846] | 120 | \annotatedlist advanced
|
---|
[556] | 121 |
|
---|
[846] | 122 | \table
|
---|
| 123 | \row
|
---|
| 124 | \o \image windowsvista-tabwidget.png
|
---|
| 125 | \o \image macintosh-groupbox.png
|
---|
| 126 | \endtable
|
---|
[556] | 127 |
|
---|
[846] | 128 | \section2 Organizer Widgets
|
---|
[556] | 129 |
|
---|
[846] | 130 | Classes like splitters, tab bars, button groups, etc are used for
|
---|
| 131 | organizing and grouping GUI primitives into more complex
|
---|
| 132 | applications and dialogs.
|
---|
[556] | 133 |
|
---|
[846] | 134 | \annotatedlist organizers
|
---|
[556] | 135 |
|
---|
[846] | 136 | \section2 Abstract Widget Classes
|
---|
[556] | 137 |
|
---|
[846] | 138 | The abstract widget classes are base classes. They are not usable as
|
---|
| 139 | standalone classes but provide functionality when they are subclassed.
|
---|
[556] | 140 |
|
---|
[846] | 141 | \annotatedlist abstractwidgets
|
---|
[556] | 142 | */
|
---|
| 143 |
|
---|
| 144 | /*!
|
---|
| 145 | \group advanced
|
---|
| 146 | \title Advanced Widgets
|
---|
| 147 | */
|
---|
| 148 |
|
---|
| 149 | /*!
|
---|
| 150 | \group abstractwidgets
|
---|
| 151 | \title Abstract Widget Classes
|
---|
| 152 | */
|
---|
| 153 |
|
---|
| 154 | /*!
|
---|
| 155 | \group basicwidgets
|
---|
| 156 | \title Basic Widgets
|
---|
| 157 | */
|
---|
| 158 |
|
---|
| 159 | /*!
|
---|
| 160 | \group organizers
|
---|
| 161 | \title Organizers
|
---|
| 162 | */
|
---|