summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qdockarealayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/qdockarealayout.cpp')
-rw-r--r--src/gui/widgets/qdockarealayout.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index 5a0a9d4815..dffec11c9c 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -1556,9 +1556,10 @@ void QDockAreaLayoutInfo::apply(bool animate)
}
}
}
-
+#ifndef QT_NO_TABBAR
if (sep == 1)
updateSeparatorWidgets();
+#endif //QT_NO_TABBAR
}
static void paintSep(QPainter *p, QWidget *w, const QRect &r, Qt::Orientation o, bool mouse_over)
@@ -2008,13 +2009,14 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
updateTabBar();
setCurrentTabId(tabId(item_list.at(index)));
}
-#endif
if (!testing && sep == 1)
updateSeparatorWidgets();
+#endif
return true;
}
+#ifndef QT_NO_TABBAR
void QDockAreaLayoutInfo::updateSeparatorWidgets() const
{
if (tabbed) {
@@ -2065,6 +2067,7 @@ void QDockAreaLayoutInfo::updateSeparatorWidgets() const
separatorWidgets.resize(j);
Q_ASSERT(separatorWidgets.size() == j);
}
+#endif //QT_NO_TABBAR
#ifndef QT_NO_TABBAR
void QDockAreaLayoutInfo::updateTabBar() const
@@ -2259,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);
@@ -2346,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;
@@ -2582,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())
@@ -2601,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);
@@ -3073,9 +3081,10 @@ void QDockAreaLayout::apply(bool animate)
widgetAnimator.animate(centralWidgetItem->widget(), centralWidgetRect,
animate);
}
-
+#ifndef QT_NO_TABBAR
if (sep == 1)
updateSeparatorWidgets();
+#endif //QT_NO_TABBAR
}
void QDockAreaLayout::paintSeparators(QPainter *p, QWidget *widget,
@@ -3153,6 +3162,7 @@ int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &or
return delta;
}
+#ifndef QT_NO_TABBAR
// Sets the correct positions for the seperator widgets
// Allocates new sepearator widgets with getSeparatorWidget
void QDockAreaLayout::updateSeparatorWidgets() const
@@ -3186,6 +3196,7 @@ void QDockAreaLayout::updateSeparatorWidgets() const
separatorWidgets.resize(j);
}
+#endif //QT_NO_TABBAR
QLayoutItem *QDockAreaLayout::itemAt(int *x, int index) const
{
@@ -3238,7 +3249,6 @@ QSet<QTabBar*> QDockAreaLayout::usedTabBars() const
}
return result;
}
-#endif
// Returns the set of all used separator widgets
QSet<QWidget*> QDockAreaLayout::usedSeparatorWidgets() const
@@ -3253,6 +3263,7 @@ QSet<QWidget*> QDockAreaLayout::usedSeparatorWidgets() const
}
return result;
}
+#endif
QRect QDockAreaLayout::gapRect(const QList<int> &path) const
{