Minor refactoring

This commit is contained in:
Sergio Martins
2020-02-25 22:53:28 +00:00
parent a286432176
commit 3f732e91a7
3 changed files with 11 additions and 5 deletions

View File

@@ -246,10 +246,8 @@ DebugWindow::DebugWindow(QWidget *parent)
layout->addWidget(button); layout->addWidget(button);
connect(button, &QPushButton::clicked, this, [] { connect(button, &QPushButton::clicked, this, [] {
const auto layouts = DockRegistry::self()->layouts(); const auto layouts = DockRegistry::self()->layouts();
for (auto l : layouts) { for (auto l : layouts)
l->redistributeSpace_recursive(l->m_leftAnchor, 0); l->redistributeSpace();
l->redistributeSpace_recursive(l->m_topAnchor, 0);
}
}); });
button = new QPushButton(this); button = new QPushButton(this);

View File

@@ -1024,7 +1024,8 @@ void MultiSplitterLayout::dumpDebug() const
{ {
Q_EMIT aboutToDumpDebug(); Q_EMIT aboutToDumpDebug();
qDebug() << Q_FUNC_INFO << "m_size=" << m_size qDebug() << Q_FUNC_INFO << "m_size=" << m_size
<< "; minimumSize=" << minimumSize(); << "; minimumSize=" << minimumSize()
<< "; parentWidget=" << multiSplitter()->size();
qDebug() << "Items:"; qDebug() << "Items:";
for (auto item : items()) { for (auto item : items()) {
@@ -1075,6 +1076,12 @@ void MultiSplitterLayout::positionStaticAnchors()
m_rightAnchor->setPosition(width() - m_rightAnchor->thickness()); m_rightAnchor->setPosition(width() - m_rightAnchor->thickness());
} }
void MultiSplitterLayout::redistributeSpace()
{
redistributeSpace_recursive(m_leftAnchor, 0);
redistributeSpace_recursive(m_topAnchor, 0);
}
void MultiSplitterLayout::redistributeSpace(QSize oldSize, QSize newSize) void MultiSplitterLayout::redistributeSpace(QSize oldSize, QSize newSize)
{ {
positionStaticAnchors(); positionStaticAnchors();

View File

@@ -550,6 +550,7 @@ private:
* When this MultiSplitter is resized, it gives or steals the less/extra space evenly through * When this MultiSplitter is resized, it gives or steals the less/extra space evenly through
* all widgets. * all widgets.
**/ **/
void redistributeSpace();
void redistributeSpace(QSize oldSize, QSize newSize); void redistributeSpace(QSize oldSize, QSize newSize);
void redistributeSpace_recursive(Anchor *fromAnchor, int minAnchorPos); void redistributeSpace_recursive(Anchor *fromAnchor, int minAnchorPos);