Fix affinity of central frame
Fixes issue #245
(cherry-picked from commit f9e758d02f)
This commit is contained in:
@@ -29,6 +29,7 @@ public:
|
||||
private:
|
||||
friend class MainWindowBase;
|
||||
friend class Frame;
|
||||
friend class ::TestDocks;
|
||||
Frame *const m_centralFrame = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -588,6 +588,8 @@ bool Frame::hasTabsVisible() const
|
||||
QStringList Frame::affinities() const
|
||||
{
|
||||
if (isEmpty()) {
|
||||
if (auto m = mainWindow())
|
||||
return m->affinities();
|
||||
return {};
|
||||
} else {
|
||||
return dockWidgetAt(0)->affinities();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "DockWidgetBase.h"
|
||||
#include "DockWidgetBase_p.h"
|
||||
#include "DropAreaWithCentralFrame_p.h"
|
||||
#include "Frame_p.h"
|
||||
#include "LayoutSaver_p.h"
|
||||
#include "MDILayoutWidget_p.h"
|
||||
#include "MainWindowMDI.h"
|
||||
@@ -7820,23 +7821,14 @@ void TestDocks::tst_closeTabOfCentralFrame()
|
||||
QVERIFY(frame->QWidgetAdapter::isVisible());
|
||||
}
|
||||
|
||||
void TestDocks::tst_centralFrame245()
|
||||
void TestDocks::tst_centralGroupAffinity()
|
||||
{
|
||||
/*
|
||||
|
||||
Build: -DKDDockWidgets_DEVELOPER_MODE=ON
|
||||
Run: ./bin/tst_docks tst_centralFrame245 -platform xcb
|
||||
|
||||
auto m = createMainWindow(QSize(500, 500), MainWindowOption_HasCentralFrame, "tst_centralFrame245");
|
||||
auto dock1 = createDockWidget("1", new QPushButton("1"));
|
||||
auto dock2 = createDockWidget("2", new QPushButton("2"));
|
||||
const QStringList affinities = { "a" };
|
||||
m->setAffinities(affinities);
|
||||
|
||||
m->addDockWidgetAsTab(dock1);
|
||||
m->addDockWidgetAsTab(dock2);
|
||||
|
||||
QTest::qWait(100000);
|
||||
|
||||
*/
|
||||
Frame *centralGroup = m->dropArea()->m_centralFrame;
|
||||
QCOMPARE(centralGroup->affinities(), affinities);
|
||||
}
|
||||
|
||||
void TestDocks::tst_persistentCentralWidget()
|
||||
|
||||
@@ -152,7 +152,7 @@ private Q_SLOTS:
|
||||
void tst_availableLengthForOrientation();
|
||||
void tst_closeShowWhenNoCentralFrame();
|
||||
void tst_closeTabOfCentralFrame();
|
||||
void tst_centralFrame245();
|
||||
void tst_centralGroupAffinity();
|
||||
void tst_setAsCurrentTab();
|
||||
void tst_placeholderDisappearsOnReadd();
|
||||
void tst_placeholdersAreRemovedProperly();
|
||||
|
||||
Reference in New Issue
Block a user