quick: Fix MultiSplitter()::mainWindow()
Works now for QtQuick
This commit is contained in:
@@ -92,6 +92,9 @@ MainWindowBase *MultiSplitter::mainWindow() const
|
||||
// Note that if pw is a FloatingWindow then pw->parentWidget() can be a MainWindow too, as it's parented
|
||||
if (pw->objectName() == QLatin1String("MyCentralWidget"))
|
||||
return qobject_cast<MainWindowBase*>(pw->parentWidget());
|
||||
|
||||
if (auto mw = qobject_cast<MainWindowBase*>(pw))
|
||||
return mw;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
||||
@@ -261,7 +261,6 @@ void TitleBar::onCloseClicked()
|
||||
|
||||
bool TitleBar::isFloating() const
|
||||
{
|
||||
|
||||
if (m_floatingWindow)
|
||||
return m_floatingWindow->hasSingleDockWidget(); // Debatable! Maybe it's always floating.
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "DockWidgetBase.h"
|
||||
#include "multisplitter/Separator_p.h"
|
||||
#include "private/MultiSplitter_p.h"
|
||||
#include "TitleBar_p.h"
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
#include <QObject>
|
||||
@@ -63,6 +64,7 @@ private Q_SLOTS:
|
||||
void tst_resizeWindow2();
|
||||
void tst_hasLastDockedLocation();
|
||||
void tst_ghostSeparator();
|
||||
void tst_detachFromMainWindow();
|
||||
};
|
||||
|
||||
void TestCommon::tst_simple1()
|
||||
@@ -173,6 +175,25 @@ void TestCommon::tst_ghostSeparator()
|
||||
delete fw3;
|
||||
}
|
||||
|
||||
void TestCommon::tst_detachFromMainWindow()
|
||||
{
|
||||
// Tests a situation where clicking the float button
|
||||
EnsureTopLevelsDeleted e;
|
||||
auto m = createMainWindow(QSize(501, 500), MainWindowOption_None);
|
||||
auto dock1 = createDockWidget("1");
|
||||
auto fw1 = dock1->window();
|
||||
m->addDockWidget(dock1, Location_OnTop);
|
||||
|
||||
QVERIFY(m->multiSplitter()->mainWindow() != nullptr);
|
||||
QVERIFY(!dock1->isFloating());
|
||||
TitleBar *tb = dock1->titleBar();
|
||||
QVERIFY(tb == dock1->frame()->titleBar());
|
||||
QVERIFY(tb->isVisible());
|
||||
QVERIFY(!tb->isFloating());
|
||||
|
||||
delete fw1;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (!qpaPassedAsArgument(argc, argv)) {
|
||||
|
||||
Reference in New Issue
Block a user