diff options
author | Vladimir Belyavsky <belyavskyv@gmail.com> | 2023-09-09 11:20:56 +0300 |
---|---|---|
committer | Vladimir Belyavsky <belyavskyv@gmail.com> | 2023-09-12 08:50:55 +0300 |
commit | 7efc0f6f1994a06359deb859fd73126d576df226 (patch) | |
tree | c04c4e69ef3e9271c731a506073ab5af01498d39 /src/gui/kernel/qwindow.cpp | |
parent | 63eaa3a989075ea0e7bd8e37dcc14c9b191330d3 (diff) |
QWindow: avoid extra window resize on changing min/max sizes
Amends e7477e8934ab38722f5589914d08b3f15e870109.
Do not call QWindow::resize() on changing min/max sizes if
bounded window size has not changed. Otherwise it may unexpectedly
reset window's state on some platforms, like Windows and Linux.
Fixes: QTBUG-115699
Pick-to: 6.5 6.6
Change-Id: I217ca3fd854a1f41d6df312e3258734d1d3bce45
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 789022b6e9..3c9194cb6e 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -612,7 +612,10 @@ void QWindowPrivate::setMinOrMaxSize(QSize *oldSizeMember, const QSize &size, // resize window if current size is outside of min and max limits if (minimumSize.width() <= maximumSize.width() || minimumSize.height() <= maximumSize.height()) { - q->resize(q->geometry().size().expandedTo(minimumSize).boundedTo(maximumSize)); + const QSize currentSize = q->size(); + const QSize boundedSize = currentSize.expandedTo(minimumSize).boundedTo(maximumSize); + if (currentSize != boundedSize) + q->resize(boundedSize); } } |