summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@digia.com>2014-10-22 13:47:55 +0200
committerPaul Olav Tvete <paul.tvete@digia.com>2014-10-24 07:54:36 +0200
commit2bfee10f3ab8e8e33b2169d735baedcdd9f2b584 (patch)
treef96e8b67235991d01539be1822d6992aa0b6f912 /src
parent77339e6bbf8baec5c15b604adbc03ab41cb37595 (diff)
QMainWindow: respect the maximum size of the central widget
Make sure the dock widgets get the available space when the central widget cannot expand any more. [ChangeLog][QtWidgets][QMainWindow] Dock widgets will now be resized properly when the central widget has a fixed size. Task-number: QTBUG-40410 Change-Id: Id06c07b79aa3102aa41212fa2c621f5fa426fe02 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 7ac2791112..702cd8bac9 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -2575,12 +2575,14 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list,
{
QSize center_hint(0, 0);
QSize center_min(0, 0);
+ QSize center_max(0, 0);
const bool have_central = centralWidgetItem != 0 && !centralWidgetItem->isEmpty();
if (have_central) {
center_hint = centralWidgetRect.size();
if (!center_hint.isValid())
center_hint = centralWidgetItem->sizeHint();
center_min = centralWidgetItem->minimumSize();
+ center_max = centralWidgetItem->maximumSize();
}
QRect center_rect = rect;
@@ -2656,7 +2658,7 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list,
left = (tl_significant && bl_significant) ? left_min.height() : 0;
right = (tr_significant && br_significant) ? right_min.height() : 0;
ver_struct_list[1].minimumSize = qMax(left, center_min.height(), right);
- ver_struct_list[1].maximumSize = have_central ? QWIDGETSIZE_MAX : 0;
+ ver_struct_list[1].maximumSize = center_max.height();
ver_struct_list[1].expansive = have_central;
ver_struct_list[1].empty = docks[QInternal::LeftDock].isEmpty()
&& !have_central
@@ -2717,7 +2719,7 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list,
bottom = (bl_significant && br_significant) ? bottom_min.width() : 0;
hor_struct_list[1].minimumSize = qMax(top, center_min.width(), bottom);
- hor_struct_list[1].maximumSize = have_central ? QWIDGETSIZE_MAX : 0;
+ hor_struct_list[1].maximumSize = center_max.width();
hor_struct_list[1].expansive = have_central;
hor_struct_list[1].empty = !have_central;
hor_struct_list[1].pos = center_rect.left();