diff options
Diffstat (limited to 'src/gui/widgets/qdockarealayout.cpp')
-rw-r--r-- | src/gui/widgets/qdockarealayout.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index ec35c4f..dffec11 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -2262,7 +2262,7 @@ QRect QDockAreaLayoutInfo::tabContentRect() const ** QDockAreaLayout */ -QDockAreaLayout::QDockAreaLayout(QMainWindow *win) +QDockAreaLayout::QDockAreaLayout(QMainWindow *win) : fallbackToSizeHints(true) { mainWindow = win; sep = win->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, win); @@ -2349,6 +2349,9 @@ bool QDockAreaLayout::restoreState(QDataStream &stream, const QList<QDockWidget* for (int i = 0; i < 4; ++i) corners[i] = static_cast<Qt::DockWidgetArea>(cornerData[i]); } + + if (!testing) + fallbackToSizeHints = false; } return ok; @@ -2585,7 +2588,7 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list, { QSize center_hint(0, 0); QSize center_min(0, 0); - bool have_central = centralWidgetItem != 0 && !centralWidgetItem->isEmpty(); + const bool have_central = centralWidgetItem != 0 && !centralWidgetItem->isEmpty(); if (have_central) { center_hint = centralWidgetRect.size(); if (!center_hint.isValid()) @@ -2604,33 +2607,35 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list, center_rect.setBottom(rect.bottom() - docks[QInternal::BottomDock].rect.height() - sep); QSize left_hint = docks[QInternal::LeftDock].size(); - if (left_hint.isNull()) + if (left_hint.isNull() || fallbackToSizeHints) left_hint = docks[QInternal::LeftDock].sizeHint(); QSize left_min = docks[QInternal::LeftDock].minimumSize(); QSize left_max = docks[QInternal::LeftDock].maximumSize(); left_hint = left_hint.boundedTo(left_max).expandedTo(left_min); QSize right_hint = docks[QInternal::RightDock].size(); - if (right_hint.isNull()) + if (right_hint.isNull() || fallbackToSizeHints) right_hint = docks[QInternal::RightDock].sizeHint(); QSize right_min = docks[QInternal::RightDock].minimumSize(); QSize right_max = docks[QInternal::RightDock].maximumSize(); right_hint = right_hint.boundedTo(right_max).expandedTo(right_min); QSize top_hint = docks[QInternal::TopDock].size(); - if (top_hint.isNull()) + if (top_hint.isNull() || fallbackToSizeHints) top_hint = docks[QInternal::TopDock].sizeHint(); QSize top_min = docks[QInternal::TopDock].minimumSize(); QSize top_max = docks[QInternal::TopDock].maximumSize(); top_hint = top_hint.boundedTo(top_max).expandedTo(top_min); QSize bottom_hint = docks[QInternal::BottomDock].size(); - if (bottom_hint.isNull()) + if (bottom_hint.isNull() || fallbackToSizeHints) bottom_hint = docks[QInternal::BottomDock].sizeHint(); QSize bottom_min = docks[QInternal::BottomDock].minimumSize(); QSize bottom_max = docks[QInternal::BottomDock].maximumSize(); bottom_hint = bottom_hint.boundedTo(bottom_max).expandedTo(bottom_min); + fallbackToSizeHints = !have_central; + if (_ver_struct_list != 0) { QVector<QLayoutStruct> &ver_struct_list = *_ver_struct_list; ver_struct_list.resize(3); |