1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the documentation of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:FDL$
9 ** GNU Free Documentation License
10 ** Alternatively, this file may be used under the terms of the GNU Free
11 ** Documentation License version 1.3 as published by the Free Software
12 ** Foundation and appearing in the file included in the packaging of
16 ** Alternatively, this file may be used in accordance with the terms
17 ** and conditions contained in a signed written agreement between you
26 ****************************************************************************/
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.
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}.
42 \image parent-child-widgets.png A parent widget containing various child widgets.
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.
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.
61 \li \image qgridlayout-with-5-children.png
62 \li \image qformlayout-with-6-children.png
65 \l{Qt Designer Manual}{\QD} is a powerful tool for interactively creating and
66 arranging widgets in layouts.
68 \section1 Widget Styles
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.
77 \li \image windowsxp-tabwidget.png
78 \li \image plastique-tabwidget.png
79 \li \image macintosh-tabwidget.png
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.
85 \section1 The Widget Classes
87 The following sections list the widget classes. See the \l{Qt Widget
88 Gallery} for some examples.
90 \section2 Basic Widgets
92 These basic widgets (controls), e.g. buttons, comboboxes and
93 scroll bars, are designed for direct use.
97 \li \image windows-label.png
98 \li \image windowsvista-pushbutton.png
99 \li \image gtk-progressbar.png
101 \li \image plastique-combobox.png
102 \li \image macintosh-radiobutton.png
103 \li \image cde-lineedit.png
106 \annotatedlist basicwidgets
108 \section2 Advanced Widgets
110 Advanced GUI widgets, e.g. tab widgets and progress bars, provide
111 more complex user interface controls.
115 \li \image windowsxp-treeview.png
116 \li \image gtk-calendarwidget.png
117 \li \image qundoview.png
120 \annotatedlist advanced
124 \li \image windowsvista-tabwidget.png
125 \li \image macintosh-groupbox.png
128 \section2 Organizer Widgets
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.
134 \annotatedlist organizers
136 \section2 Abstract Widget Classes
138 The abstract widget classes are base classes. They are not usable as
139 standalone classes but provide functionality when they are subclassed.
141 \annotatedlist abstractwidgets
146 \title Advanced Widgets
150 \group abstractwidgets
151 \title Abstract Widget Classes