summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qmdiarea.cpp
diff options
context:
space:
mode:
authorNick D'Ademo <nickdademo@gmail.com>2018-11-03 13:58:09 +0800
committerNick D'Ademo <nickdademo@gmail.com>2018-12-04 07:39:16 +0000
commit4c585690852e2c3e3700c2060ef0408a7e533d4e (patch)
treee0edd5cc8f9f9042b27247d2082a849539cda6c7 /src/widgets/widgets/qmdiarea.cpp
parentb5e0d854bd22e56e1567d0e6dd89e9eb7035338f (diff)
QMdiArea: Take scroll bars into account when tiling subwindows
QMdiAreaPrivate::resizeToMinimumTileSize() does not take into account scroll bars when calculating the minimum size for the QMdiArea widget. As a result, if scroll bars are enabled or showing during a tiling operation, the top-level widget incorrectly expands in size (instead of utilizing the scroll bars). Therefore, we should only resize the top-level widget if scroll bars are disabled. Fixes: QTBUG-40821 Change-Id: I3a8b7582d23fdf12d2b09f3740eea6b60bb395c3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/widgets/qmdiarea.cpp')
-rw-r--r--src/widgets/widgets/qmdiarea.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index c1817060dd..cdc1291511 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -1296,7 +1296,11 @@ QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, in
minAreaHeight += 2 * frame;
}
const QSize diff = QSize(minAreaWidth, minAreaHeight).expandedTo(q->size()) - q->size();
- topLevel->resize(topLevel->size() + diff);
+ // Only resize topLevel widget if scroll bars are disabled.
+ if (hbarpolicy == Qt::ScrollBarAlwaysOff)
+ topLevel->resize(topLevel->size().width() + diff.width(), topLevel->size().height());
+ if (vbarpolicy == Qt::ScrollBarAlwaysOff)
+ topLevel->resize(topLevel->size().width(), topLevel->size().height() + diff.height());
}
QRect domain = viewport->rect();