forked from qt-creator/qt-creator
ProjectWindow: Add a PanelsWidget convenience constructor
... combining default construction plus a single invocation of addPropertiesPanel(), the only way it is ever used. Change-Id: I2080e8b8fa25a2d7e429b7c18f5272466bc4eb79 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -147,6 +147,12 @@ PanelsWidget::PanelsWidget(QWidget *parent) :
|
|||||||
//layout->addWidget(new FindToolBarPlaceHolder(this));
|
//layout->addWidget(new FindToolBarPlaceHolder(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PanelsWidget::PanelsWidget(const QString &displayName, const QIcon &icon, QWidget *widget)
|
||||||
|
: PanelsWidget()
|
||||||
|
{
|
||||||
|
addPropertiesPanel(displayName, icon, widget);
|
||||||
|
}
|
||||||
|
|
||||||
PanelsWidget::~PanelsWidget()
|
PanelsWidget::~PanelsWidget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -42,6 +42,8 @@ class PROJECTEXPLORER_EXPORT PanelsWidget : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PanelsWidget(QWidget *parent = nullptr);
|
explicit PanelsWidget(QWidget *parent = nullptr);
|
||||||
|
PanelsWidget(const QString &displayName, const QIcon &icon,
|
||||||
|
QWidget *widget);
|
||||||
~PanelsWidget() override;
|
~PanelsWidget() override;
|
||||||
|
|
||||||
void addPropertiesPanel(const QString &displayName, const QIcon &icon,
|
void addPropertiesPanel(const QString &displayName, const QIcon &icon,
|
||||||
|
@@ -103,13 +103,11 @@ QVariant MiscSettingsPanelItem::data(int column, int role) const
|
|||||||
|
|
||||||
if (role == PanelWidgetRole) {
|
if (role == PanelWidgetRole) {
|
||||||
if (!m_widget) {
|
if (!m_widget) {
|
||||||
auto panelsWidget = new PanelsWidget;
|
|
||||||
QWidget *widget = m_factory->createWidget(m_project);
|
QWidget *widget = m_factory->createWidget(m_project);
|
||||||
panelsWidget->addPropertiesPanel(m_factory->displayName(),
|
m_widget = new PanelsWidget(m_factory->displayName(),
|
||||||
QIcon(m_factory->icon()),
|
QIcon(m_factory->icon()),
|
||||||
widget);
|
widget);
|
||||||
panelsWidget->setFocusProxy(widget);
|
m_widget->setFocusProxy(widget);
|
||||||
m_widget = panelsWidget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant::fromValue<QWidget *>(m_widget.data());
|
return QVariant::fromValue<QWidget *>(m_widget.data());
|
||||||
|
@@ -248,27 +248,23 @@ void TargetGroupItemPrivate::ensureWidget()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!m_configurePage) {
|
if (!m_configurePage) {
|
||||||
auto panelsWidget = new PanelsWidget;
|
|
||||||
auto widget = new TargetSetupPageWrapper(m_project);
|
auto widget = new TargetSetupPageWrapper(m_project);
|
||||||
panelsWidget->addPropertiesPanel(tr("Configure Project"),
|
m_configurePage = new PanelsWidget(tr("Configure Project"),
|
||||||
QIcon(":/projectexplorer/images/unconfigured.png"),
|
QIcon(":/projectexplorer/images/unconfigured.png"),
|
||||||
widget);
|
widget);
|
||||||
panelsWidget->setFocusProxy(widget);
|
m_configurePage->setFocusProxy(widget);
|
||||||
m_configurePage = panelsWidget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_configuredPage) {
|
if (!m_configuredPage) {
|
||||||
auto panelsWidget = new PanelsWidget;
|
|
||||||
auto widget = new QWidget;
|
auto widget = new QWidget;
|
||||||
auto label = new QLabel("This project is already configured.");
|
auto label = new QLabel("This project is already configured.");
|
||||||
auto layout = new QVBoxLayout(widget);
|
auto layout = new QVBoxLayout(widget);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
layout->addWidget(label);
|
layout->addWidget(label);
|
||||||
layout->addStretch(10);
|
layout->addStretch(10);
|
||||||
panelsWidget->addPropertiesPanel(tr("Configure Project"),
|
m_configuredPage = new PanelsWidget(tr("Configure Project"),
|
||||||
QIcon(":/projectexplorer/images/unconfigured.png"),
|
QIcon(":/projectexplorer/images/unconfigured.png"),
|
||||||
widget);
|
widget);
|
||||||
m_configuredPage = panelsWidget;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,10 +604,7 @@ public:
|
|||||||
l->addWidget(widget);
|
l->addWidget(widget);
|
||||||
l->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
l->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
||||||
l->setContentsMargins(QMargins());
|
l->setContentsMargins(QMargins());
|
||||||
|
return new PanelsWidget(displayName, QIcon(icon), w);
|
||||||
auto result = new PanelsWidget;
|
|
||||||
result->addPropertiesPanel(displayName, QIcon(icon), w);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *panel() const
|
QWidget *panel() const
|
||||||
|
Reference in New Issue
Block a user