summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2014-08-27 08:55:36 +0200
committerJan Arve Sæther <jan-arve.saether@digia.com>2014-08-28 09:38:52 +0200
commit4648dc566f72454fb49142b9f55929c9b9502853 (patch)
treeaa8570534bde9e656e82a0c9c63f87e6767b35a2
parent6492a65d280e5b6a916f52498a9e39005cc2d51f (diff)
downloadqtquickcontrols-4648dc566f72454fb49142b9f55929c9b9502853.tar.gz
Include potential toolBar+menuBar+statusBar when calculating height
Change-Id: Id005e81656f1fc2085360240bfd30342c0e7954b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
-rw-r--r--src/controls/ApplicationWindow.qml2
-rw-r--r--tests/auto/controls/data/tst_applicationwindow.qml32
2 files changed, 33 insertions, 1 deletions
diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml
index 0edfe5ea..185f33ef 100644
--- a/src/controls/ApplicationWindow.qml
+++ b/src/controls/ApplicationWindow.qml
@@ -180,7 +180,7 @@ Window {
target: root
property: "__height"
when: root.minimumHeight <= root.maximumHeight
- value: Math.max(Math.min(root.maximumHeight, contentArea.implicitHeight), root.minimumHeight)
+ value: Math.max(Math.min(root.maximumHeight, contentArea.implicitHeight + __topBottomMargins), root.minimumHeight)
}
width: contentArea.__noImplicitWidthGiven ? 0 : __width
height: contentArea.__noImplicitHeightGiven ? 0 : __height
diff --git a/tests/auto/controls/data/tst_applicationwindow.qml b/tests/auto/controls/data/tst_applicationwindow.qml
index 72dfb1cd..a746f276 100644
--- a/tests/auto/controls/data/tst_applicationwindow.qml
+++ b/tests/auto/controls/data/tst_applicationwindow.qml
@@ -260,5 +260,37 @@ TestCase {
window.destroy()
}
+ function test_windowHeight() {
+ var test_control = 'import QtQuick 2.2; \
+ import QtQuick.Controls 1.2; \
+ ApplicationWindow { \
+ toolBar: ToolBar { \
+ ToolButton { \
+ text: "Menu" \
+ } \
+ } \
+ statusBar: StatusBar { \
+ Row { \
+ Label { \
+ text: "Window test" \
+ } \
+ } \
+ } \
+ \
+ Rectangle { \
+ anchors.fill: parent; \
+ implicitWidth: 300; \
+ implicitHeight: 300; \
+ } \
+ } '
+
+ var window = Qt.createQmlObject(test_control, container, '')
+ window.visible = true
+ waitForRendering(window.contentItem)
+ compare(window.contentItem.implicitHeight, 300)
+ verify(window.height > 300)
+ window.destroy()
+ }
+
}
}