aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/Page.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-10-24 16:36:23 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-10-25 07:21:29 +0000
commitcb80c055e7d8a242c529c9f72c9a9b8d87a90f31 (patch)
tree39ad3246eda83e0c505bcb8b807c92ee9e3130bb /src/imports/controls/Page.qml
parent32810acaa191ba00be5aac5d771c23b87628292c (diff)
Page: provide implicit size
Even though the control was designed to be used as full-screen page, it can be sometimes useful to have non-fullscreen pages. In order to make Page behave well in layouts, it must provide a suitable implicit size. [ChangeLog][Controls][Page] Page has been made to calculate its implicit size based on the implicit size of the header, content, and footer plus paddings, and the implicit size of the background item. Task-number: QTBUG-56709 Change-Id: I0f40897df6e54d7bde01a464e24f0398b12bc865 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls/Page.qml')
-rw-r--r--src/imports/controls/Page.qml12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/imports/controls/Page.qml b/src/imports/controls/Page.qml
index 630f8426..fbed527f 100644
--- a/src/imports/controls/Page.qml
+++ b/src/imports/controls/Page.qml
@@ -42,6 +42,18 @@ import QtQuick.Templates 2.1 as T
T.Page {
id: control
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ Math.max(contentWidth,
+ header && header.visible ? header.implicitWidth : 0,
+ footer && footer.visible ? footer.implicitWidth : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentHeight + topPadding + bottomPadding
+ + (header && header.visible ? header.implicitHeight : 0)
+ + (footer && footer.visible ? footer.implicitHeight : 0))
+
+ contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
+ contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+
//! [background]
background: Rectangle {
color: Default.backgroundColor