summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qdockarealayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/widgets/qdockarealayout.cpp')
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 50be36ae93..63f8172bf6 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -1493,8 +1493,10 @@ bool QDockAreaLayoutInfo::hasFixedSize() const
return perp(o, minimumSize()) == perp(o, maximumSize());
}
-
-void QDockAreaLayoutInfo::apply(bool animate)
+/*! \internal
+ Applies the layout and returns the activated QDockWidget or nullptr.
+ */
+QDockWidget *QDockAreaLayoutInfo::apply(bool animate)
{
QWidgetAnimator &widgetAnimator = mainWindowLayout()->widgetAnimator;
@@ -1533,6 +1535,8 @@ void QDockAreaLayoutInfo::apply(bool animate)
}
#endif // QT_NO_TABBAR
+ QDockWidget *activated = nullptr;
+
for (int i = 0; i < item_list.size(); ++i) {
QDockAreaLayoutItem &item = item_list[i];
@@ -1561,6 +1565,7 @@ void QDockAreaLayoutInfo::apply(bool animate)
} else if (r.isValid()
&& (geo.right() < 0 || geo.bottom() < 0)) {
emit dw->visibilityChanged(true);
+ activated = dw;
}
}
}
@@ -1568,6 +1573,8 @@ void QDockAreaLayoutInfo::apply(bool animate)
if (*sep == 1)
updateSeparatorWidgets();
#endif //QT_NO_TABBAR
+
+ return activated;
}
static void paintSep(QPainter *p, QWidget *w, const QRect &r, Qt::Orientation o, bool mouse_over)
@@ -1928,7 +1935,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
QDockAreaLayoutItem item(new QDockWidgetItem(widget));
if (flags & StateFlagFloating) {
bool drawer = false;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC // drawer support
+#if 0 // Used to be included in Qt4 for Q_WS_MAC // drawer support
extern bool qt_mac_is_macdrawer(const QWidget *); //qwidget_mac.cpp
extern bool qt_mac_set_drawer_preferred_edge(QWidget *, Qt::DockWidgetArea); //qwidget_mac.cpp
drawer = qt_mac_is_macdrawer(widget);
@@ -1943,7 +1950,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
int x, y, w, h;
stream >> x >> y >> w >> h;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC // drawer support
+#if 0 // Used to be included in Qt4 for Q_WS_MAC // drawer support
if (drawer) {
mainWindow->window()->createWinId();
widget->window()->createWinId();
@@ -2043,7 +2050,7 @@ void QDockAreaLayoutInfo::updateSeparatorWidgets() const
}
j++;
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
sepWidget->raise();
#endif
QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2);
@@ -3078,7 +3085,7 @@ bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget)
dockWidget->d_func()->setWindowState(true, true, r);
}
dockWidget->setVisible(!placeHolder->hidden);
-#ifdef Q_DEAD_CODE_FROM_QT4_X11
+#if 0 // Used to be included in Qt4 for Q_WS_X11
if (placeHolder->window) // gets rid of the X11BypassWindowManager window flag
dockWidget->d_func()->setWindowState(true);
#endif
@@ -3309,7 +3316,7 @@ void QDockAreaLayout::updateSeparatorWidgets() const
}
j++;
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
sepWidget->raise();
#endif
QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2);