summaryrefslogtreecommitdiffstats
path: root/doc/src/tutorials/widgets-tutorial.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/tutorials/widgets-tutorial.qdoc')
-rw-r--r--doc/src/tutorials/widgets-tutorial.qdoc83
1 files changed, 30 insertions, 53 deletions
diff --git a/doc/src/tutorials/widgets-tutorial.qdoc b/doc/src/tutorials/widgets-tutorial.qdoc
index 2125edcd03..4877339348 100644
--- a/doc/src/tutorials/widgets-tutorial.qdoc
+++ b/doc/src/tutorials/widgets-tutorial.qdoc
@@ -27,6 +27,7 @@
/*!
\page widgets-tutorial.html
+ \ingroup tutorials
\title Widgets Tutorial
\brief This tutorial covers basic usage of widgets and layouts, showing how
they are used to build GUI applications.
@@ -133,19 +134,13 @@
In the following example, we use QWidget to create and show a window with
a default size:
- \raw HTML
- <table align="left" width="100%">
- <tr class="qt-code"><td>
- \endraw
- \snippet tutorials/widgets/toplevel/main.cpp main program
- \raw HTML
- </td><td align="right">
- \endraw
- \inlineimage widgets-tutorial-toplevel.png
- \raw HTML
- </td></tr>
- </table>
- \endraw
+ \div {class="qt-code"}
+ \table
+ \row
+ \o \snippet tutorials/widgets/toplevel/main.cpp main program
+ \o \inlineimage widgets-tutorial-toplevel.png
+ \endtable
+ \enddiv
To create a real GUI, we need to place widgets inside the window. To do
this, we pass a QWidget instance to a widget's constructor, as we will
@@ -161,19 +156,13 @@
passing \c window as the parent to its constructor. In this case, we add a
button to the window and place it in a specific location:
- \raw HTML
- <table align="left" width="100%">
- <tr class="qt-code"><td>
- \endraw
- \snippet tutorials/widgets/childwidget/main.cpp main program
- \raw HTML
- </td><td align="right">
- \endraw
- \inlineimage widgets-tutorial-childwidget.png
- \raw HTML
- </td></tr>
- </table>
- \endraw
+ \div {class="qt-code"}
+ \table
+ \row
+ \o \snippet tutorials/widgets/childwidget/main.cpp main program
+ \o \inlineimage widgets-tutorial-childwidget.png
+ \endtable
+ \enddiv
The button is now a child of the window and will be deleted when the
window is destroyed. Note that hiding or closing the window does not
@@ -189,19 +178,13 @@
construct a label and line edit widget that we would like to arrange
side-by-side.
- \raw HTML
- <table align="left" width="100%">
- <tr class="qt-code"><td>
- \endraw
- \snippet tutorials/widgets/windowlayout/main.cpp main program
- \raw HTML
- </td><td align="right">
- \endraw
- \inlineimage widgets-tutorial-windowlayout.png
- \raw HTML
- </td></tr>
- </table>
- \endraw
+ \div {class="qt-code"}
+ \table
+ \row
+ \o \snippet tutorials/widgets/windowlayout/main.cpp main program
+ \o \inlineimage widgets-tutorial-windowlayout.png
+ \endtable
+ \enddiv
The \c layout object we construct manages the positions and sizes of
widgets supplied to it with the \l{QHBoxLayout::}{addWidget()} function.
@@ -233,20 +216,14 @@
\c{mainLayout} is a QVBoxLayout that contains \c{queryLayout} and a
QTableView arranged vertically.
- \raw HTML
- <table align="left" width="100%">
- <tr class="qt-code"><td>
- \endraw
- \snippet tutorials/widgets/nestedlayouts/main.cpp first part
- \snippet tutorials/widgets/nestedlayouts/main.cpp last part
- \raw HTML
- </td><td align="right">
- \endraw
- \inlineimage widgets-tutorial-nestedlayouts.png
- \raw HTML
- </td></tr>
- </table>
- \endraw
+ \div {class="qt-code"}
+ \table
+ \row
+ \o \snippet tutorials/widgets/nestedlayouts/main.cpp first part
+ \snippet tutorials/widgets/nestedlayouts/main.cpp last part
+ \o \inlineimage widgets-tutorial-nestedlayouts.png
+ \endtable
+ \enddiv
Note that we call the \c{mainLayout}'s \l{QBoxLayout::}{addLayout()}
function to insert the \c{queryLayout} above the \c{resultView} table.