Doc: Updated Layout examples.
-added links to and from the overviews. -added information on how to run the example. -updated copyright. Task-number: QTBUG-33597 Change-Id: Ib049cb94f136caa6916878959ae830248bd236b5 Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Nico Vertriest <nico.vertriest@digia.com>
This commit is contained in:
parent
7da3228abb
commit
857c82f8a4
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||||
** Contact: http://www.qt-project.org/legal
|
** Contact: http://www.qt-project.org/legal
|
||||||
**
|
**
|
||||||
** This file is part of the documentation of the Qt Toolkit.
|
** This file is part of the documentation of the Qt Toolkit.
|
||||||
@ -28,31 +28,35 @@
|
|||||||
/*!
|
/*!
|
||||||
\example layouts/basiclayouts
|
\example layouts/basiclayouts
|
||||||
\title Basic Layouts Example
|
\title Basic Layouts Example
|
||||||
|
\brief Shows how to use the standard layout managers.
|
||||||
|
|
||||||
\brief The Basic Layouts example shows how to use the standard layout
|
\e{Basic Layouts} shows how to use the standard layout managers that are
|
||||||
managers that are available in Qt: QBoxLayout, QGridLayout and
|
available in Qt: QBoxLayout, QGridLayout, and QFormLayout.
|
||||||
QFormLayout.
|
|
||||||
|
|
||||||
\image basiclayouts-example.png Screenshot of the Basic Layouts example
|
\image basiclayouts-example.png Screenshot of the Basic Layouts example
|
||||||
|
|
||||||
The QBoxLayout class lines up widgets horizontally or vertically.
|
The QBoxLayout class lines up widgets horizontally or vertically.
|
||||||
QHBoxLayout and QVBoxLayout are convenience subclasses of QBoxLayout.
|
QHBoxLayout and QVBoxLayout are convenience subclasses of QBoxLayout.
|
||||||
QGridLayout lays out widgets in cells by dividing the available space
|
QGridLayout lays out widgets in cells by dividing the available space
|
||||||
into rows and columns. QFormLayout, on the other hand, lays out its
|
into rows and columns. QFormLayout, on the other hand, sets its
|
||||||
children in a two-column form with labels in the left column and
|
children in a two-column form with labels in the left column and
|
||||||
input fields in the right column.
|
input fields in the right column.
|
||||||
|
|
||||||
|
For more information, visit the \l{Layout Management} page.
|
||||||
|
|
||||||
|
\include examples-run.qdocinc
|
||||||
|
|
||||||
\section1 Dialog Class Definition
|
\section1 Dialog Class Definition
|
||||||
|
|
||||||
\snippet layouts/basiclayouts/dialog.h 0
|
\snippet layouts/basiclayouts/dialog.h 0
|
||||||
|
|
||||||
The \c Dialog class inherits QDialog. It is a custom widget that
|
The \c Dialog class inherits QDialog. It is a custom widget that
|
||||||
displays its child widgets using the geometry managers:
|
displays its child widgets using the geometry managers:
|
||||||
QHBoxLayout, QVBoxLayout, QGridLayout and QFormLayout.
|
QHBoxLayout, QVBoxLayout, QGridLayout, and QFormLayout.
|
||||||
|
|
||||||
We declare four private functions to simplify the class
|
There are four private functions to simplify the class
|
||||||
constructor: The \c createMenu(), \c createHorizontalGroupBox(),
|
constructor: the \c createMenu(), \c createHorizontalGroupBox(),
|
||||||
\c createGridGroupBox() and \c createFormGroupBox() functions create
|
\c createGridGroupBox(), and \c createFormGroupBox() functions create
|
||||||
several widgets that the example uses to demonstrate how the layout
|
several widgets that the example uses to demonstrate how the layout
|
||||||
affects their appearances.
|
affects their appearances.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||||
** Contact: http://www.qt-project.org/legal
|
** Contact: http://www.qt-project.org/legal
|
||||||
**
|
**
|
||||||
** This file is part of the documentation of the Qt Toolkit.
|
** This file is part of the documentation of the Qt Toolkit.
|
||||||
@ -28,9 +28,14 @@
|
|||||||
/*!
|
/*!
|
||||||
\example layouts/borderlayout
|
\example layouts/borderlayout
|
||||||
\title Border Layout Example
|
\title Border Layout Example
|
||||||
|
\brief Shows how to arrange child widgets along a border.
|
||||||
|
|
||||||
\brief The Border Layout example shows how to create a custom layout that arranges
|
\e{Border Layout} implements a layout that arranges child widgets to
|
||||||
child widgets according to a simple set of rules.
|
surround the main area.
|
||||||
|
|
||||||
\image borderlayout-example.png
|
\image borderlayout-example.png
|
||||||
|
|
||||||
|
For more information, visit the \l{Layout Management} page.
|
||||||
|
|
||||||
|
\include examples-run.qdocinc
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||||
** Contact: http://www.qt-project.org/legal
|
** Contact: http://www.qt-project.org/legal
|
||||||
**
|
**
|
||||||
** This file is part of the documentation of the Qt Toolkit.
|
** This file is part of the documentation of the Qt Toolkit.
|
||||||
@ -28,7 +28,13 @@
|
|||||||
/*!
|
/*!
|
||||||
\example layouts/dynamiclayouts
|
\example layouts/dynamiclayouts
|
||||||
\title Dynamic Layouts Example
|
\title Dynamic Layouts Example
|
||||||
|
\brief Shows how to re-orient widgets in running applications.
|
||||||
|
|
||||||
\brief The Dynamic Layouts example shows how to move widgets around in
|
\e{Dynamic Layouts} implements dynamically placed widgets within running
|
||||||
existing layouts.
|
applications. The widget placement depends on whether \c Horizontal or \c
|
||||||
|
Vertical is chosen.
|
||||||
|
|
||||||
|
For more information, visit the \l{Layout Management} page.
|
||||||
|
|
||||||
|
\include examples-run.qdocinc
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||||
** Contact: http://www.qt-project.org/legal
|
** Contact: http://www.qt-project.org/legal
|
||||||
**
|
**
|
||||||
** This file is part of the documentation of the Qt Toolkit.
|
** This file is part of the documentation of the Qt Toolkit.
|
||||||
@ -28,18 +28,19 @@
|
|||||||
/*!
|
/*!
|
||||||
\example layouts/flowlayout
|
\example layouts/flowlayout
|
||||||
\title Flow Layout Example
|
\title Flow Layout Example
|
||||||
|
\brief Shows how to arrange widgets for different window sizes.
|
||||||
|
|
||||||
\brief The Flow Layout example demonstrates a custom layout that arranges child
|
\e{Flow Layout} implements a layout that handles different window sizes. The
|
||||||
widgets from left to right and top to bottom in a top-level widget.
|
widget placement changes depending on the width of the application window.
|
||||||
|
|
||||||
\image flowlayout-example.png Screenshot of the Flow Layout example
|
\image flowlayout-example.png Screenshot of the Flow Layout example
|
||||||
|
|
||||||
The items are first laid out horizontally and then vertically when each line
|
|
||||||
in the layout runs out of space.
|
|
||||||
|
|
||||||
The Flowlayout class mainly uses QLayout and QWidgetItem, while the
|
The Flowlayout class mainly uses QLayout and QWidgetItem, while the
|
||||||
Window uses QWidget and QLabel. We will only document the definition
|
Window uses QWidget and QLabel.
|
||||||
and implementation of \c FlowLayout below.
|
|
||||||
|
For more information, visit the \l{Layout Management} page.
|
||||||
|
|
||||||
|
\include examples-run.qdocinc
|
||||||
|
|
||||||
\section1 FlowLayout Class Definition
|
\section1 FlowLayout Class Definition
|
||||||
|
|
||||||
|
@ -139,6 +139,7 @@ interfaces
|
|||||||
\section2 Examples
|
\section2 Examples
|
||||||
\list
|
\list
|
||||||
\li \l{Qt Widgets Examples}
|
\li \l{Qt Widgets Examples}
|
||||||
|
\li \l{Layout Examples}
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
\section1 API Reference
|
\section1 API Reference
|
||||||
|
@ -386,5 +386,13 @@
|
|||||||
then set it. (This does not only apply to layouts, you should do
|
then set it. (This does not only apply to layouts, you should do
|
||||||
the same if you implement your own resizeEvent(), for example.)
|
the same if you implement your own resizeEvent(), for example.)
|
||||||
\endlist
|
\endlist
|
||||||
*/
|
|
||||||
|
|
||||||
|
\section1 Layout Examples
|
||||||
|
|
||||||
|
Many Qt Widgets \l{Qt Widgets Examples}{examples} already use layouts,
|
||||||
|
however, several examples exist to showcase various layouts.
|
||||||
|
|
||||||
|
\list
|
||||||
|
\li \l{Layout Examples}
|
||||||
|
\endlist
|
||||||
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user