diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2014-02-28 09:40:47 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-03 14:18:55 +0100 |
commit | be37e3123808be44170beeea413b97ef9a312ef2 (patch) | |
tree | 8ad50a22f1ec9669b46e924ad228ced364dcd195 /src/controls/ApplicationWindow.qml | |
parent | 258df8b2f5e693636436b68bd233bd2671a25ac4 (diff) | |
download | qtquickcontrols-be37e3123808be44170beeea413b97ef9a312ef2.tar.gz |
Avoid warning when maximum size < minimum size
This only happens in intermediate states, where both *minimumHeight*
and *maximumHeight* is supposed to be updated.
However, since the order of the bindings is not know, we might
have intermediate states where minimumHeight > maximumHeight.
In our case minimumHeight was set first to a smaller size than
maximumHeight, this would trigger the height binding, causing it to try
to set its geometry while its minimumHeight and maximumHeight properties
were not in sync.
This also happened when maximumWidth < minimumWidth.
The output was something like this:
qwindowswindow.cpp(1306):QWindowsWindow::setGeometry: Attempt to set a
size (116x190) violating the constraints(0x200 - 16777215x190) on
window ApplicationWindow_QMLTYPE_12_QML_51/''
Change-Id: Ia4f6e340b608bb4cff5a35bc887adc4eea7efbad
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src/controls/ApplicationWindow.qml')
-rw-r--r-- | src/controls/ApplicationWindow.qml | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml index f54fa8f5..bb969946 100644 --- a/src/controls/ApplicationWindow.qml +++ b/src/controls/ApplicationWindow.qml @@ -149,8 +149,24 @@ Window { */ readonly property real __qwindowsize_max: (1 << 24) - 1 - width: contentArea.__noImplicitWidthGiven ? 0 : Math.min(Math.max(minimumWidth, contentArea.implicitWidth), maximumWidth) - height: contentArea.__noImplicitHeightGiven ? 0 : Math.min(Math.max(minimumHeight, contentArea.implicitHeight + __topBottomMargins), maximumHeight) + /*! \internal */ + property real __width: 0 + Binding { + target: root + property: "__width" + when: root.minimumWidth <= root.maximumWidth + value: Math.max(Math.min(root.maximumWidth, contentArea.implicitWidth), root.minimumWidth) + } + /*! \internal */ + property real __height: 0 + Binding { + target: root + property: "__height" + when: root.minimumHeight <= root.maximumHeight + value: Math.max(Math.min(root.maximumHeight, contentArea.implicitHeight), root.minimumHeight) + } + width: contentArea.__noImplicitWidthGiven ? 0 : __width + height: contentArea.__noImplicitHeightGiven ? 0 : __height minimumWidth: contentArea.__noMinimumWidthGiven ? 0 : contentArea.minimumWidth minimumHeight: contentArea.__noMinimumHeightGiven ? 0 : (contentArea.minimumHeight + __topBottomMargins) |