wip
This commit is contained in:
@@ -2147,11 +2147,6 @@ void ItemContainer::shrinkNeighbours(int index, SizingInfo::List &sizes, int sid
|
||||
}
|
||||
}
|
||||
|
||||
Anchor::List ItemContainer::separators() const
|
||||
{
|
||||
return m_separators;
|
||||
}
|
||||
|
||||
QVector<int> ItemContainer::requiredSeparatorPositions() const
|
||||
{
|
||||
const int numSeparators = qMax(0, numVisibleChildren() - 1);
|
||||
@@ -2241,3 +2236,15 @@ bool ItemContainer::isHorizontal() const
|
||||
{
|
||||
return m_orientation == Qt::Horizontal;
|
||||
}
|
||||
|
||||
QVector<Layouting::Anchor*> ItemContainer::separators_recursive() const
|
||||
{
|
||||
Layouting::Anchor::List separators = m_separators;
|
||||
|
||||
for (Item *item : m_children) {
|
||||
if (auto c = item->asContainer())
|
||||
separators << c->separators_recursive();
|
||||
}
|
||||
|
||||
return separators;
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ public:
|
||||
Item::List m_children;
|
||||
bool m_isResizing = false;
|
||||
bool m_blockUpdatePercentages = false;
|
||||
QVector<Layouting::Anchor*> separators() const;
|
||||
QVector<Layouting::Anchor*> separators_recursive() const;
|
||||
Qt::Orientation m_orientation = Qt::Vertical;
|
||||
private:
|
||||
/// Returns the positions that each separator should have (x position if Qt::Horizontal, y otherwise)
|
||||
|
||||
@@ -71,8 +71,6 @@ MultiSplitterLayout::~MultiSplitterLayout()
|
||||
{
|
||||
qCDebug(multisplittercreation) << "~MultiSplitter" << this;
|
||||
m_inDestructor = true;
|
||||
const auto anchors = m_anchors;
|
||||
qDeleteAll(anchors);
|
||||
if (m_rootItem->hostWidget() == multiSplitter())
|
||||
delete m_rootItem;
|
||||
DockRegistry::self()->unregisterLayout(this);
|
||||
@@ -260,15 +258,9 @@ void MultiSplitterLayout::setAnchorBeingDragged(Anchor *anchor)
|
||||
m_anchorBeingDragged = anchor;
|
||||
}
|
||||
|
||||
int MultiSplitterLayout::numVisibleAnchors() const
|
||||
Anchor::List MultiSplitterLayout::anchors() const
|
||||
{
|
||||
int count = 0;
|
||||
for (Anchor *a : m_anchors) {
|
||||
if (a->separatorWidget()->isVisible())
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
return m_rootItem->separators_recursive();
|
||||
}
|
||||
|
||||
void MultiSplitterLayout::updateSizeConstraints()
|
||||
|
||||
@@ -180,10 +180,7 @@ public:
|
||||
bool anchorIsBeingDragged() const { return m_anchorBeingDragged != nullptr; }
|
||||
|
||||
///@brief returns list of separators
|
||||
const Layouting::Anchor::List anchors() const { return m_anchors; }
|
||||
|
||||
///@brief returns the number of anchors that are following others, just for tests.
|
||||
int numVisibleAnchors() const;
|
||||
Layouting::Anchor::List anchors() const;
|
||||
|
||||
/**
|
||||
* @brief Updates the min size of this layout.
|
||||
@@ -341,7 +338,6 @@ private:
|
||||
QString affinityName() const;
|
||||
|
||||
MultiSplitter *const m_multiSplitter;
|
||||
Layouting::Anchor::List m_anchors;
|
||||
|
||||
bool m_inCtor = true;
|
||||
bool m_inDestructor = false;
|
||||
|
||||
@@ -293,7 +293,7 @@ private Q_SLOTS:
|
||||
void tst_setAstCurrentTab();
|
||||
void tst_closeShowWhenNoCentralFrame();
|
||||
void tst_placeholderDisappearsOnReadd();
|
||||
void tst_placeholdersAreRemovedPropertly();
|
||||
void tst_placeholdersAreRemovedProperly();
|
||||
void tst_embeddedMainWindow();
|
||||
void tst_toggleMiddleDockCrash(); // tests some crash I got
|
||||
// void tst_28NestedWidgets();
|
||||
@@ -3177,7 +3177,7 @@ void TestDocks::tst_placeholderDisappearsOnReadd()
|
||||
QVERIFY(Testing::waitForDeleted(fw));
|
||||
}
|
||||
|
||||
void TestDocks::tst_placeholdersAreRemovedPropertly()
|
||||
void TestDocks::tst_placeholdersAreRemovedProperly()
|
||||
{
|
||||
EnsureTopLevelsDeleted e;
|
||||
auto m = createMainWindow(QSize(800, 500), MainWindowOption_None); // Remove central frame
|
||||
@@ -3191,12 +3191,11 @@ void TestDocks::tst_placeholdersAreRemovedPropertly()
|
||||
dock1->setFloating(true);
|
||||
QVERIFY(item->isPlaceholder());
|
||||
|
||||
QCOMPARE(layout->anchors().size(), 5);
|
||||
QCOMPARE(layout->anchors().size(), 0);
|
||||
QCOMPARE(layout->count(), 2);
|
||||
QCOMPARE(layout->placeholderCount(), 1);
|
||||
layout->removeItem(item);
|
||||
|
||||
QCOMPARE(layout->anchors().size(), 4);
|
||||
QCOMPARE(layout->anchors().size(), 0);
|
||||
QCOMPARE(layout->count(), 1);
|
||||
QCOMPARE(layout->placeholderCount(), 0);
|
||||
|
||||
@@ -3205,7 +3204,7 @@ void TestDocks::tst_placeholdersAreRemovedPropertly()
|
||||
dock1->setFloating(true);
|
||||
QPointer<QWidget> window1 = dock1->window();
|
||||
delete dock1;
|
||||
QCOMPARE(layout->anchors().size(), 4);
|
||||
QCOMPARE(layout->anchors().size(), 0);
|
||||
QCOMPARE(layout->count(), 1);
|
||||
QCOMPARE(layout->placeholderCount(), 0);
|
||||
layout->checkSanity();
|
||||
@@ -3686,7 +3685,7 @@ void TestDocks::tst_resizeViaAnchorsAfterPlaceholderCreation()
|
||||
Testing::waitForResize(dock3);
|
||||
|
||||
MultiSplitterLayout *layout = m->multiSplitterLayout();
|
||||
QCOMPARE(layout->numVisibleAnchors(), 5);
|
||||
QCOMPARE(layout->anchors().size(), 5);
|
||||
layout->checkSanity();
|
||||
|
||||
// Cleanup:
|
||||
|
||||
Reference in New Issue
Block a user