forked from qt-creator/qt-creator
ProjectExplorer: allow adding expanding project settings widgets
Change-Id: I27dee2a8d1b14d1dcc535669e3dc9c5369ec2c81 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -32,7 +32,7 @@ const int BELOW_CONTENTS_MARGIN = 16;
|
|||||||
// PanelsWidget
|
// PanelsWidget
|
||||||
///
|
///
|
||||||
|
|
||||||
PanelsWidget::PanelsWidget(QWidget *parent) : QWidget(parent)
|
PanelsWidget::PanelsWidget(QWidget *parent, bool addStretch) : QWidget(parent)
|
||||||
{
|
{
|
||||||
m_root = new QWidget(nullptr);
|
m_root = new QWidget(nullptr);
|
||||||
m_root->setFocusPolicy(Qt::NoFocus);
|
m_root->setFocusPolicy(Qt::NoFocus);
|
||||||
@@ -53,7 +53,8 @@ PanelsWidget::PanelsWidget(QWidget *parent) : QWidget(parent)
|
|||||||
m_layout->setSpacing(0);
|
m_layout->setSpacing(0);
|
||||||
|
|
||||||
topLayout->addLayout(m_layout);
|
topLayout->addLayout(m_layout);
|
||||||
topLayout->addStretch(100);
|
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);
|
||||||
@@ -72,7 +73,7 @@ PanelsWidget::PanelsWidget(const QString &displayName, QWidget *widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PanelsWidget::PanelsWidget(const QString &displayName, ProjectSettingsWidget *widget)
|
PanelsWidget::PanelsWidget(const QString &displayName, ProjectSettingsWidget *widget)
|
||||||
: PanelsWidget(nullptr)
|
: PanelsWidget(nullptr, !widget->expanding())
|
||||||
{
|
{
|
||||||
addPropertiesPanel(displayName);
|
addPropertiesPanel(displayName);
|
||||||
addGlobalSettingsProperties(widget);
|
addGlobalSettingsProperties(widget);
|
||||||
|
@@ -19,7 +19,7 @@ class PROJECTEXPLORER_EXPORT PanelsWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PanelsWidget(QWidget *parent = nullptr);
|
explicit PanelsWidget(QWidget *parent = nullptr, bool addStretch = true);
|
||||||
PanelsWidget(const QString &displayName, QWidget *widget);
|
PanelsWidget(const QString &displayName, QWidget *widget);
|
||||||
PanelsWidget(const QString &displayName, ProjectSettingsWidget *widget);
|
PanelsWidget(const QString &displayName, ProjectSettingsWidget *widget);
|
||||||
~PanelsWidget() override;
|
~PanelsWidget() override;
|
||||||
|
@@ -65,4 +65,14 @@ void ProjectSettingsWidget::setGlobalSettingsId(Utils::Id globalId)
|
|||||||
m_globalSettingsId = globalId;
|
m_globalSettingsId = globalId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ProjectSettingsWidget::expanding() const
|
||||||
|
{
|
||||||
|
return m_expanding;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectSettingsWidget::setExpanding(bool expanding)
|
||||||
|
{
|
||||||
|
m_expanding = expanding;
|
||||||
|
}
|
||||||
|
|
||||||
} // ProjectExplorer
|
} // ProjectExplorer
|
||||||
|
@@ -27,6 +27,9 @@ public:
|
|||||||
bool isUseGlobalSettingsLabelVisible() const;
|
bool isUseGlobalSettingsLabelVisible() const;
|
||||||
Utils::Id globalSettingsId() const;
|
Utils::Id globalSettingsId() const;
|
||||||
|
|
||||||
|
bool expanding() const;
|
||||||
|
void setExpanding(bool expanding);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setUseGlobalSettingsCheckBoxVisible(bool visible);
|
void setUseGlobalSettingsCheckBoxVisible(bool visible);
|
||||||
void setUseGlobalSettingsLabelVisible(bool visible);
|
void setUseGlobalSettingsLabelVisible(bool visible);
|
||||||
@@ -41,6 +44,7 @@ private:
|
|||||||
bool m_useGlobalSettingsCheckBoxEnabled = true;
|
bool m_useGlobalSettingsCheckBoxEnabled = true;
|
||||||
bool m_useGlobalSettingsCheckBoxVisibleVisible = true;
|
bool m_useGlobalSettingsCheckBoxVisibleVisible = true;
|
||||||
bool m_useGlobalSettingsLabelVisibleVisible = true;
|
bool m_useGlobalSettingsLabelVisibleVisible = true;
|
||||||
|
bool m_expanding = false;
|
||||||
Utils::Id m_globalSettingsId;
|
Utils::Id m_globalSettingsId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user