summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp11
-rw-r--r--src/widgets/widgets/qdockarealayout_p.h2
-rw-r--r--src/widgets/widgets/qmainwindow.cpp12
-rw-r--r--src/widgets/widgets/qmainwindow.h3
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp6
-rw-r--r--tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp54
6 files changed, 84 insertions, 4 deletions
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index c14fd5a942..3b185a5e67 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)
diff --git a/src/widgets/widgets/qdockarealayout_p.h b/src/widgets/widgets/qdockarealayout_p.h
index 0ae1350394..591b156902 100644
--- a/src/widgets/widgets/qdockarealayout_p.h
+++ b/src/widgets/widgets/qdockarealayout_p.h
@@ -174,7 +174,7 @@ public:
QList<int> indexOf(QWidget *widget) const;
QList<int> indexOfPlaceHolder(const QString &objectName) const;
- void apply(bool animate);
+ QDockWidget *apply(bool animate);
void paintSeparators(QPainter *p, QWidget *widget, const QRegion &clip,
const QPoint &mouse) const;
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index f86244172d..5dfa439b2e 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -377,6 +377,18 @@ void QMainWindowPrivate::init()
\sa setToolButtonStyle()
*/
+#ifndef QT_NO_DOCKWIDGET
+/*!
+ \fn void QMainWindow::tabifiedDockWidgetActivated(QDockWidget *dockWidget)
+
+ This signal is emitted when the tabified dock widget is activated by
+ selecting the tab. The activated dock widget is passed in \a dockWidget.
+
+ \since 5.8
+ \sa tabifyDockWidget(), tabifiedDockWidgets()
+*/
+#endif
+
/*!
Constructs a QMainWindow with the given \a parent and the specified
widget \a flags.
diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h
index aab1448b8f..4622d89e4c 100644
--- a/src/widgets/widgets/qmainwindow.h
+++ b/src/widgets/widgets/qmainwindow.h
@@ -195,6 +195,9 @@ public Q_SLOTS:
Q_SIGNALS:
void iconSizeChanged(const QSize &iconSize);
void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle);
+#ifndef QT_NO_DOCKWIDGET
+ void tabifiedDockWidgetActivated(QDockWidget *dockWidget);
+#endif
protected:
#ifndef QT_NO_CONTEXTMENU
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 6c05887705..ee6da73302 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -1686,7 +1686,11 @@ void QMainWindowLayout::tabChanged()
QDockAreaLayoutInfo *info = dockInfo(tb);
if (info == 0)
return;
- info->apply(false);
+
+ QDockWidget *activated = info->apply(false);
+
+ if (activated)
+ emit static_cast<QMainWindow *>(parentWidget())->tabifiedDockWidgetActivated(activated);
if (QWidget *w = centralWidget())
w->raise();
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
index 9f8d4e4588..30e4f63aa1 100644
--- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
@@ -45,6 +45,10 @@
#include <private/qmainwindowlayout_p.h>
#include <private/qdockarealayout_p.h>
+#ifndef QT_NO_TABBAR
+#include <qtabbar.h>
+#endif
+
static uchar restoreData41[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x0, 0x0, 0x0, 0x0, 0xfd, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x64, 0x0, 0x0, 0x1, 0x19, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x34, 0x1, 0x0, 0x0, 0x0, 0x49, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0,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0xd6, 0x0, 0x0, 0x0, 0x68, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x66, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0xb8, 0x0, 0x0, 0x0, 0xa0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8, 0xfc, 0x0, 0x0, 0x0, 0x0};
@@ -144,6 +148,9 @@ private slots:
void QTBUG21378_animationFinished();
void resizeDocks();
void resizeDocks_data();
+#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_TABBAR)
+ void QTBUG52175_tabifiedDockWidgetActivated();
+#endif
};
@@ -2033,5 +2040,52 @@ void tst_QMainWindow::resizeDocks()
}
}
+#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_TABBAR)
+void tst_QMainWindow::QTBUG52175_tabifiedDockWidgetActivated()
+{
+ QMainWindow w;
+
+ QDockWidget *dwFirst = new QDockWidget(&w);
+ dwFirst->setWidget(new QWidget(dwFirst));
+ w.addDockWidget(Qt::LeftDockWidgetArea, dwFirst);
+
+ QDockWidget *dwSecond = new QDockWidget(&w);
+ dwSecond->setWidget(new QWidget(dwSecond));
+ w.addDockWidget(Qt::LeftDockWidgetArea, dwSecond);
+
+ w.tabifyDockWidget(dwFirst, dwSecond);
+ w.show();
+ QVERIFY(QTest::qWaitForWindowActive(&w));
+
+ QTabBar *tabBar = w.findChild<QTabBar *>();
+ QVERIFY(tabBar);
+
+ QDockWidget *activated = nullptr;
+ connect(&w, &QMainWindow::tabifiedDockWidgetActivated, [&activated](QDockWidget *dockWidget)
+ {
+ activated = dockWidget;
+ });
+
+ w.hide();
+ QCoreApplication::processEvents();
+ QCOMPARE(activated, nullptr);
+
+ w.show();
+ QCoreApplication::processEvents();
+ QCOMPARE(activated, nullptr);
+
+ tabBar->setCurrentIndex(1);
+ QCoreApplication::processEvents();
+ QCOMPARE(activated, nullptr);
+
+ tabBar->setCurrentIndex(0);
+ QTRY_COMPARE(activated, dwFirst);
+ activated = nullptr;
+
+ tabBar->setCurrentIndex(1);
+ QTRY_COMPARE(activated, dwSecond);
+}
+#endif
+
QTEST_MAIN(tst_QMainWindow)
#include "tst_qmainwindow.moc"