aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@theqtcompany.com>2016-02-18 13:28:59 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-26 13:18:27 +0000
commit974643829f677247a8b06aba563a28714b48f1a9 (patch)
tree2e040aacedff10bb0f579081bbae21693fea01be /src/quick/doc
parentfb2710a7f182ffb910f6b121e8bc125a4f61dcdf (diff)
Move QtQuick.Layouts to qtdeclarative from qtquickcontrols
This is in order for it to be available without having to install Qt Quick Controls Change-Id: I3f0d0dc108829947cd189b7861944e556e00cef3 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/quick/doc')
-rw-r--r--src/quick/doc/images/columnlayout.pngbin0 -> 348 bytes
-rw-r--r--src/quick/doc/images/gridlayout.pngbin0 -> 2530 bytes
-rw-r--r--src/quick/doc/images/qtquicklayouts-example-layouts.pngbin0 -> 24795 bytes
-rw-r--r--src/quick/doc/images/rowlayout-minimum.pngbin0 -> 5481 bytes
-rw-r--r--src/quick/doc/images/rowlayout.pngbin0 -> 2627 bytes
-rw-r--r--src/quick/doc/qtquick.qdocconf2
-rw-r--r--src/quick/doc/snippets/qml/windowconstraints.qml76
-rw-r--r--src/quick/doc/src/concepts/layouts/qtquicklayouts-index.qdoc54
-rw-r--r--src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc176
-rw-r--r--src/quick/doc/src/concepts/layouts/qtquicklayouts.qdoc46
-rw-r--r--src/quick/doc/src/qtquick.qdoc1
11 files changed, 354 insertions, 1 deletions
diff --git a/src/quick/doc/images/columnlayout.png b/src/quick/doc/images/columnlayout.png
new file mode 100644
index 0000000000..f03eb7b996
--- /dev/null
+++ b/src/quick/doc/images/columnlayout.png
Binary files differ
diff --git a/src/quick/doc/images/gridlayout.png b/src/quick/doc/images/gridlayout.png
new file mode 100644
index 0000000000..493813c481
--- /dev/null
+++ b/src/quick/doc/images/gridlayout.png
Binary files differ
diff --git a/src/quick/doc/images/qtquicklayouts-example-layouts.png b/src/quick/doc/images/qtquicklayouts-example-layouts.png
new file mode 100644
index 0000000000..94619bae3f
--- /dev/null
+++ b/src/quick/doc/images/qtquicklayouts-example-layouts.png
Binary files differ
diff --git a/src/quick/doc/images/rowlayout-minimum.png b/src/quick/doc/images/rowlayout-minimum.png
new file mode 100644
index 0000000000..5875325c54
--- /dev/null
+++ b/src/quick/doc/images/rowlayout-minimum.png
Binary files differ
diff --git a/src/quick/doc/images/rowlayout.png b/src/quick/doc/images/rowlayout.png
new file mode 100644
index 0000000000..519a62fddd
--- /dev/null
+++ b/src/quick/doc/images/rowlayout.png
Binary files differ
diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf
index 044c1696ff..4f141a733a 100644
--- a/src/quick/doc/qtquick.qdocconf
+++ b/src/quick/doc/qtquick.qdocconf
@@ -33,7 +33,7 @@ qhp.QtQuick.subprojects.examples.selectors = fake:example
tagfile = ../../../doc/qtquick/qtquick.tags
-depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtquicklayouts qtdoc qtquickdialogs qtsensors qtwidgets qmake qtmultimedia qtgraphicaleffects
+depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtdoc qtquickdialogs qtsensors qtwidgets qmake qtmultimedia qtgraphicaleffects
headerdirs += ..\
../../quickwidgets
diff --git a/src/quick/doc/snippets/qml/windowconstraints.qml b/src/quick/doc/snippets/qml/windowconstraints.qml
new file mode 100644
index 0000000000..3f3534f494
--- /dev/null
+++ b/src/quick/doc/snippets/qml/windowconstraints.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Layouts 1.2
+import QtQuick.Window 2.2
+
+Window {
+ //! [binddefaultsize]
+ width: layout.implicitWidth
+ height: layout.implicitHeight
+ //! [binddefaultsize]
+ //! [bindconstraints]
+ minimumWidth: layout.Layout.minimumWidth
+ minimumHeight: layout.Layout.minimumHeight
+ maximumWidth: 1000
+ maximumHeight: layout.Layout.maximumHeight
+ //! [bindconstraints]
+
+ //! [rowlayout]
+ //! [anchoring]
+ RowLayout {
+ id: layout
+ anchors.fill: parent
+ //! [anchoring]
+ spacing: 6
+ Rectangle {
+ color: 'azure'
+ Layout.fillWidth: true
+ Layout.minimumWidth: 50
+ Layout.preferredWidth: 100
+ Layout.maximumWidth: 300
+ Layout.minimumHeight: 150
+ Text {
+ anchors.centerIn: parent
+ text: parent.width + 'x' + parent.height
+ }
+ }
+ Rectangle {
+ color: 'plum'
+ Layout.fillWidth: true
+ Layout.minimumWidth: 100
+ Layout.preferredWidth: 200
+ Layout.preferredHeight: 100
+ Text {
+ anchors.centerIn: parent
+ text: parent.width + 'x' + parent.height
+ }
+ }
+ }
+ //! [rowlayout]
+}
diff --git a/src/quick/doc/src/concepts/layouts/qtquicklayouts-index.qdoc b/src/quick/doc/src/concepts/layouts/qtquicklayouts-index.qdoc
new file mode 100644
index 0000000000..0be66fad2c
--- /dev/null
+++ b/src/quick/doc/src/concepts/layouts/qtquicklayouts-index.qdoc
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquicklayouts-index.html
+ \title Qt Quick Layouts
+ \brief A module with a set of QML elements that arrange QML items in a user interface.
+
+ Qt Quick Layouts are a set of QML types used to arrange items in a user interface. In contrast
+ to \l{Item Positioners}{positioners}, Qt Quick Layouts can also resize their items. This makes
+ them well suited for resizable user interfaces. Since layouts are items they can consequently
+ be nested.
+
+ The module is new in Qt 5.1 and requires \l{Qt Quick} 2.1.
+
+ Visit the \l{Qt Quick Layouts Overview} page to get started.
+
+ \section1 Layouts
+
+ \annotatedlist layouts
+
+ \section1 Related information
+
+ \list
+ \li \l{Qt Quick}
+ \li \l{Qt Quick Layouts Overview}
+ \li \l{Qt Quick Layouts - Basic Example}
+ \li \l{Qt Quick Layouts QML Types}{Qt Quick Layouts QML Types}
+ \endlist
+*/
diff --git a/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc b/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc
new file mode 100644
index 0000000000..1b6e7dc539
--- /dev/null
+++ b/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquicklayouts-overview.html
+ \title Qt Quick Layouts Overview
+ \brief A set of APIs for arranging QML items in a user interface.
+
+ Qt Quick Layouts are items that are used to arrange items in a user interface. Since Qt Quick
+ Layouts also resize their items, they are well suited for resizable user interfaces.
+
+ \section1 Getting started
+
+ The QML types can be imported into your application using the following import statement in your \c {.qml} file.
+
+ \code
+ import QtQuick.Layouts 1.2
+ \endcode
+
+ \section1 Key Features
+
+
+ Some of the key features are:
+
+ \list
+ \li \l{Layout::alignment}{Alignment} of items can be specified with the
+ \l{Layout::alignment}{Layout.alignment} property
+ \li \l{Layout::fillWidth}{Resizable items} can be specified with the
+ \l{Layout::fillWidth}{Layout.fillWidth} and \l{Layout::fillHeight}{Layout.fillHeight}
+ properties.
+ \li \l{Size constraints} can be specified with
+ \l{Layout::minimumWidth}{Layout.minimumWidth},
+ \l{Layout::preferredWidth}{Layout.preferredWidth}, and
+ \l{Layout::maximumWidth}{Layout.maximumWidth} properties ("Width" can be replaced
+ with "Height" for specifying similar constraints to the height).
+ \li \l{RowLayout::spacing}{Spacings} can be specified with \l{RowLayout::spacing}{spacing},
+ \l{GridLayout::rowSpacing}{rowSpacing} or \l{GridLayout::columnSpacing}{columnSpacing}
+ \endlist
+
+ In addition to the above features, GridLayout adds these features:
+ \list
+ \li \l{Layout::row}{Grid coordinates} can be specified with the \l{Layout::row}{Layout.row} and
+ \l{Layout::column}{Layout.column}.
+ \li \l{GridLayout::flow}{Automatic grid coordinates} used together with the
+ \l{GridLayout::flow}{flow}, \l{GridLayout::rows}{rows}, and
+ \l{GridLayout::columns}{columns} properties.
+ \li \l{Layout::columnSpan}{Spans} across rows or columns can be specified with the
+ \l{Layout::rowSpan}{Layout.rowSpan} and \l{Layout::columnSpan}{Layout.columnSpan}
+ properties.
+ \endlist
+
+
+
+ \section1 Size Constraints
+ Since an item can be resized by its layout, the layout needs to know the
+ \l{Layout::minimumWidth}{minimum}, \l{Layout::preferredWidth}{preferred},
+ and \l{Layout::maximumWidth}{maximum} sizes of all items where \l{Layout::fillWidth}{Layout.fillWidth} or
+ \l{Layout::fillHeight}{Layout.fillHeight} is set to \c true.
+ For instance, the following will produce a layout with two rectangles lying side-by-side that
+ stretches horizontally. The azure rectangle can be resized from 50x150 to 300x150, and the plum
+ rectangle can be resized from 100x100 to ∞x100.
+
+ \snippet windowconstraints.qml rowlayout
+
+ \image rowlayout-minimum.png "RowLayout at its minimum"
+
+ Combining each item's constraints will give these implicit constraints to the layout element:
+
+ \table
+ \header
+ \li
+ \li minimum
+ \li preferred
+ \li maximum
+ \row
+ \li implicit constraints (width)
+ \li 156
+ \li 306
+ \li ∞ (\c Number.POSITIVE_INFINITY)
+ \row
+ \li implicit constraints (heights)
+ \li 150
+ \li 150
+ \li 150
+ \endtable
+
+ Thus, the layout cannot be narrower than 156 or be taller or shorter than 150 without breaking
+ any of the constraints of its child items.
+
+ \section2 Specifying Preferred Size
+ For each item, the effective preferred size may come from one of several candidate properties.
+ For determining the effective preferred size, it will query these candidate properties in the
+ following order, and use the first candidate with a valid width or height.
+
+ \table
+ \header
+ \li Candidate properties
+ \li Description
+ \row
+ \li \l{Layout::preferredWidth}{Layout.preferredWidth} or
+ \l{Layout::preferredHeight}{Layout.preferredHeight}
+ \li These properties are supposed to be modified by the application if the default implicit
+ size does not give the optimal arrangement.
+ \row
+ \li \l{Item::implicitWidth}{implicitWidth} or \l{Item::implicitHeight}{implicitHeight}
+ \li These properties are supposed to be supplied by each item to give a meaningful ideal size,
+ for example the size needed to display all the contents of a \l Text type.
+ An implicit width or height of \c 0 is interpreted as invalid.
+ \row
+ \li \l{Item::width}{width} and \l{Item::height}{height}
+ \li If none of the above properties are valid, the layout will resort to the
+ \l{Item::width}{width} and \l{Item::height}{height} properties.
+ \endtable
+
+ An item can specify \l{Layout::preferredWidth}{Layout.preferredWidth} without having to specify
+ \l{Layout::preferredHeight}{Layout.preferredHeight}. In this case, the effective preferred
+ height will be determined from the \l{Item::implicitHeight}{implicitHeight} (or ultimately
+ \l{Item::height}{height}).
+
+ \note Resorting to \l{Item::width}{width} or \l{Item::height}{height} properties is only
+ provided as a final fallback. If you want to override the preferred size, it is recommended to
+ use \l{Layout::preferredWidth}{Layout.preferredWidth} or
+ \l{Layout::preferredHeight}{Layout.preferredHeight}. Relying on the \l{Item::width}{width} or
+ \l{Item::height}{height} properties for specifying the preferred size might give some
+ unexpected behavior. For instance, changing the \l{Item::width}{width} or
+ \l{Item::height}{height} properties won't trigger a layout rearrangement. Also, when the layout
+ is forced to do a full rebuild it might use the actual width and height, and not the width and
+ height specified in the QML file.
+
+
+ \section1 Connecting windows and layouts
+ You can just use normal anchoring concepts to ensure that the layout will follow the window
+ resizing.
+
+ \snippet qml/windowconstraints.qml anchoring
+
+ The size constraints of layouts can be used to ensure that the window cannot be resized beyond
+ the layout constraints. You can take the size constraints from the layout and set these
+ constraints on the minimumWidth, minimumHeight, maximumWidth, and maximumHeight of the Window
+ element. The following code ensures that the window cannot be resized beyond the constraints of
+ the layout:
+
+ \snippet qml/windowconstraints.qml bindconstraints
+
+ \note Since layout.Layout.maximumWidth is infinite in this case, we cannot bind that to the
+ maximumWidth property of Window, since that is an integer number. We therefore set a fixed
+ maximum width to 1000.
+
+ Finally, you usually want the initial size of the window to be the layout's implicit size:
+
+ \snippet qml/windowconstraints.qml binddefaultsize
+*/
diff --git a/src/quick/doc/src/concepts/layouts/qtquicklayouts.qdoc b/src/quick/doc/src/concepts/layouts/qtquicklayouts.qdoc
new file mode 100644
index 0000000000..8f390c83db
--- /dev/null
+++ b/src/quick/doc/src/concepts/layouts/qtquicklayouts.qdoc
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule QtQuick.Layouts 1.3
+ \title Qt Quick Layouts QML Types
+ \ingroup qmlmodules
+ \brief Provides QML types for arranging QML items in a user interface.
+
+ The \l{Qt Quick Layouts} module provides QML types for arranging
+ QML items in a user interface.
+ These QML types work in conjunction with \l{Qt Quick} and
+ \l{Qt Quick Controls}.
+
+ The QML types can be imported into your application using the
+ following import statement in your .qml file.
+
+ \code
+ import QtQuick.Layouts 1.3
+ \endcode
+
+*/
diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc
index 98a77a48d8..4bdd02241d 100644
--- a/src/quick/doc/src/qtquick.qdoc
+++ b/src/quick/doc/src/qtquick.qdoc
@@ -101,6 +101,7 @@ Additional Qt Quick information:
containing a JavaScript interface for an SQLite database
\li \l{Qt Quick Particles QML Types}{Particles} - provides a particle
system for Qt Quick
+ \li \l{Qt Quick Layouts}{Layouts} - provides layouts for arranging Qt Quick items
\li \l{Qt Quick Window QML Types}{Window} - contains types for creating
top-level windows and accessing screen information
\li \l{Qt Quick Dialogs}{Dialogs} - contains types for creating and