aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-09-21 16:47:49 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-09-23 05:15:30 +0000
commitbebbd47cf6b00326cb504cf6bc95da678271a893 (patch)
treef7bb2b09a3da165a4229be25ff7fc56d3d5dc5f0 /src
parentb16b3cbd24aa6c412a4441a12895804b54526659 (diff)
Pane: fix documentation review findings
Change-Id: I59b40f68aa1f2985bfc15de26f587df6a88c09eb Task-number: QTBUG-55904 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates2/qquickpane.cpp74
1 files changed, 62 insertions, 12 deletions
diff --git a/src/quicktemplates2/qquickpane.cpp b/src/quicktemplates2/qquickpane.cpp
index f2141619..9f9c139b 100644
--- a/src/quicktemplates2/qquickpane.cpp
+++ b/src/quicktemplates2/qquickpane.cpp
@@ -54,8 +54,10 @@ QT_BEGIN_NAMESPACE
\l ColumnLayout.
Items declared as children of a Pane are automatically parented to the
- Pane's contentItem. Items created dynamically need to be explicitly
- parented to the contentItem.
+ Pane's \l {Control::}{contentItem}. Items created dynamically need to be
+ explicitly parented to the contentItem.
+
+ \section1 Content Sizing
If only a single item is used within a Pane, it will resize to fit the
implicit size of its contained item. This makes it particularly suitable
@@ -65,6 +67,40 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols2-pane.qml 1
+ Sometimes there might be two items within the pane:
+
+ \code
+ Pane {
+ SwipeView {
+ // ...
+ }
+ PageIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ }
+ }
+ \endcode
+
+ In this case, Pane cannot calculate a sensible implicit size. Since we're
+ anchoring the \l PageIndicator over the \l SwipeView, we can simply set the
+ content size to the view's implicit size:
+
+ \code
+ Pane {
+ contentWidth: view.implicitWidth
+ contentHeight: view.implicitHeight
+
+ SwipeView {
+ id: view
+ // ...
+ }
+ PageIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ }
+ }
+ \endcode
+
\sa {Customizing Pane}, {Container Controls}
*/
@@ -89,11 +125,12 @@ QQuickPane::QQuickPane(QQuickPanePrivate &dd, QQuickItem *parent) :
/*!
\qmlproperty real QtQuick.Controls::Pane::contentWidth
- This property holds the content width. It is used for calculating the
- total implicit width of the pane.
+ This property holds the content width. It is used for calculating the total
+ implicit width of the pane.
- \note If only a single item is used within the pane, the implicit width
- of its contained item is used as the content width.
+ For more information, see \l {Content Sizing}.
+
+ \sa contentHeight
*/
qreal QQuickPane::contentWidth() const
{
@@ -114,11 +151,12 @@ void QQuickPane::setContentWidth(qreal width)
/*!
\qmlproperty real QtQuick.Controls::Pane::contentHeight
- This property holds the content height. It is used for calculating the
- total implicit height of the pane.
+ This property holds the content height. It is used for calculating the total
+ implicit height of the pane.
+
+ For more information, see \l {Content Sizing}.
- \note If only a single item is used within the pane, the implicit height
- of its contained item is used as the content height.
+ \sa contentWidth
*/
qreal QQuickPane::contentHeight() const
{
@@ -142,7 +180,13 @@ void QQuickPane::setContentHeight(qreal height)
This property holds the list of content data.
- \sa Item::data
+ The list contains all objects that have been declared in QML as children
+ of the pane.
+
+ \note Unlike \c contentChildren, \c contentData does include non-visual QML
+ objects.
+
+ \sa Item::data, contentChildren
*/
QQmlListProperty<QObject> QQuickPane::contentData()
{
@@ -159,7 +203,13 @@ QQmlListProperty<QObject> QQuickPane::contentData()
This property holds the list of content children.
- \sa Item::children
+ The list contains all items that have been declared in QML as children
+ of the pane.
+
+ \note Unlike \c contentData, \c contentChildren does not include non-visual
+ QML objects.
+
+ \sa Item::children, contentData
*/
QQmlListProperty<QQuickItem> QQuickPane::contentChildren()
{