forked from qt-creator/qt-creator
ProjectExplorer: Remove an unnecessarily nested layout
Change-Id: Icbde0f82e0f7ae1d6c378256716a0d55abdda075 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -91,6 +91,7 @@ public:
|
|||||||
explicit ProjectPanel(QWidget *inner, bool addGlobalSettings, bool addStretch)
|
explicit ProjectPanel(QWidget *inner, bool addGlobalSettings, bool addStretch)
|
||||||
{
|
{
|
||||||
setWindowTitle(inner->windowTitle());
|
setWindowTitle(inner->windowTitle());
|
||||||
|
setFocusProxy(inner);
|
||||||
|
|
||||||
auto root = new QWidget(nullptr);
|
auto root = new QWidget(nullptr);
|
||||||
root->setFocusPolicy(Qt::NoFocus);
|
root->setFocusPolicy(Qt::NoFocus);
|
||||||
@@ -102,18 +103,11 @@ public:
|
|||||||
scroller->setWidgetResizable(true);
|
scroller->setWidgetResizable(true);
|
||||||
scroller->setFocusPolicy(Qt::NoFocus);
|
scroller->setFocusPolicy(Qt::NoFocus);
|
||||||
|
|
||||||
// The layout holding the individual panels:
|
// The layout holding the panel.
|
||||||
auto topLayout = new QVBoxLayout(root);
|
auto topLayout = new QVBoxLayout(root);
|
||||||
topLayout->setContentsMargins(PanelVMargin, 0, PanelVMargin, 0);
|
topLayout->setContentsMargins(PanelVMargin, 0, PanelVMargin, 0);
|
||||||
topLayout->setSpacing(0);
|
topLayout->setSpacing(0);
|
||||||
|
|
||||||
m_layout = new QVBoxLayout;
|
|
||||||
m_layout->setSpacing(0);
|
|
||||||
|
|
||||||
topLayout->addLayout(m_layout);
|
|
||||||
if (addStretch)
|
|
||||||
topLayout->addStretch(1);
|
|
||||||
|
|
||||||
auto layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
@@ -125,7 +119,6 @@ public:
|
|||||||
auto widget = dynamic_cast<ProjectSettingsWidget *>(inner);
|
auto widget = dynamic_cast<ProjectSettingsWidget *>(inner);
|
||||||
if (QTC_GUARD(widget)) {
|
if (QTC_GUARD(widget)) {
|
||||||
if (widget->isUseGlobalSettingsCheckBoxVisible() || widget->isUseGlobalSettingsLabelVisible()) {
|
if (widget->isUseGlobalSettingsCheckBoxVisible() || widget->isUseGlobalSettingsLabelVisible()) {
|
||||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
const auto useGlobalSettingsCheckBox = new QCheckBox;
|
const auto useGlobalSettingsCheckBox = new QCheckBox;
|
||||||
useGlobalSettingsCheckBox->setChecked(widget->useGlobalSettings());
|
useGlobalSettingsCheckBox->setChecked(widget->useGlobalSettings());
|
||||||
useGlobalSettingsCheckBox->setEnabled(widget->isUseGlobalSettingsCheckBoxEnabled());
|
useGlobalSettingsCheckBox->setEnabled(widget->isUseGlobalSettingsCheckBoxEnabled());
|
||||||
@@ -161,21 +154,19 @@ public:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
horizontalLayout->addStretch(1);
|
horizontalLayout->addStretch(1);
|
||||||
m_layout->addLayout(horizontalLayout);
|
topLayout->addLayout(horizontalLayout);
|
||||||
m_layout->addWidget(Layouting::createHr());
|
topLayout->addWidget(Layouting::createHr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inner->setContentsMargins(0, CONTENTS_MARGIN, 0, BELOW_CONTENTS_MARGIN);
|
inner->setContentsMargins(0, CONTENTS_MARGIN, 0, BELOW_CONTENTS_MARGIN);
|
||||||
inner->setParent(root);
|
inner->setParent(root);
|
||||||
m_layout->addWidget(inner);
|
topLayout->addWidget(inner);
|
||||||
|
|
||||||
setFocusProxy(inner);
|
if (addStretch)
|
||||||
|
topLayout->addStretch(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
QVBoxLayout *m_layout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user