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));
|
||||
}
|
||||
|
||||
PanelsWidget::PanelsWidget(const QString &displayName, const QIcon &icon, QWidget *widget)
|
||||
: PanelsWidget()
|
||||
{
|
||||
addPropertiesPanel(displayName, icon, widget);
|
||||
}
|
||||
|
||||
PanelsWidget::~PanelsWidget()
|
||||
{
|
||||
}
|
||||
|
@@ -42,6 +42,8 @@ class PROJECTEXPLORER_EXPORT PanelsWidget : public QWidget
|
||||
|
||||
public:
|
||||
explicit PanelsWidget(QWidget *parent = nullptr);
|
||||
PanelsWidget(const QString &displayName, const QIcon &icon,
|
||||
QWidget *widget);
|
||||
~PanelsWidget() override;
|
||||
|
||||
void addPropertiesPanel(const QString &displayName, const QIcon &icon,
|
||||
|
@@ -103,13 +103,11 @@ QVariant MiscSettingsPanelItem::data(int column, int role) const
|
||||
|
||||
if (role == PanelWidgetRole) {
|
||||
if (!m_widget) {
|
||||
auto panelsWidget = new PanelsWidget;
|
||||
QWidget *widget = m_factory->createWidget(m_project);
|
||||
panelsWidget->addPropertiesPanel(m_factory->displayName(),
|
||||
QIcon(m_factory->icon()),
|
||||
widget);
|
||||
panelsWidget->setFocusProxy(widget);
|
||||
m_widget = panelsWidget;
|
||||
m_widget = new PanelsWidget(m_factory->displayName(),
|
||||
QIcon(m_factory->icon()),
|
||||
widget);
|
||||
m_widget->setFocusProxy(widget);
|
||||
}
|
||||
|
||||
return QVariant::fromValue<QWidget *>(m_widget.data());
|
||||
|
@@ -248,27 +248,23 @@ void TargetGroupItemPrivate::ensureWidget()
|
||||
}
|
||||
|
||||
if (!m_configurePage) {
|
||||
auto panelsWidget = new PanelsWidget;
|
||||
auto widget = new TargetSetupPageWrapper(m_project);
|
||||
panelsWidget->addPropertiesPanel(tr("Configure Project"),
|
||||
QIcon(":/projectexplorer/images/unconfigured.png"),
|
||||
widget);
|
||||
panelsWidget->setFocusProxy(widget);
|
||||
m_configurePage = panelsWidget;
|
||||
m_configurePage = new PanelsWidget(tr("Configure Project"),
|
||||
QIcon(":/projectexplorer/images/unconfigured.png"),
|
||||
widget);
|
||||
m_configurePage->setFocusProxy(widget);
|
||||
}
|
||||
|
||||
if (!m_configuredPage) {
|
||||
auto panelsWidget = new PanelsWidget;
|
||||
auto widget = new QWidget;
|
||||
auto label = new QLabel("This project is already configured.");
|
||||
auto layout = new QVBoxLayout(widget);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(label);
|
||||
layout->addStretch(10);
|
||||
panelsWidget->addPropertiesPanel(tr("Configure Project"),
|
||||
QIcon(":/projectexplorer/images/unconfigured.png"),
|
||||
widget);
|
||||
m_configuredPage = panelsWidget;
|
||||
m_configuredPage = new PanelsWidget(tr("Configure Project"),
|
||||
QIcon(":/projectexplorer/images/unconfigured.png"),
|
||||
widget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,10 +604,7 @@ public:
|
||||
l->addWidget(widget);
|
||||
l->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
||||
l->setContentsMargins(QMargins());
|
||||
|
||||
auto result = new PanelsWidget;
|
||||
result->addPropertiesPanel(displayName, QIcon(icon), w);
|
||||
return result;
|
||||
return new PanelsWidget(displayName, QIcon(icon), w);
|
||||
}
|
||||
|
||||
QWidget *panel() const
|
||||
|
Reference in New Issue
Block a user