diff --git a/src/plugins/projectexplorer/panelswidget.cpp b/src/plugins/projectexplorer/panelswidget.cpp index 5d7f9a866ed..e2828c8306d 100644 --- a/src/plugins/projectexplorer/panelswidget.cpp +++ b/src/plugins/projectexplorer/panelswidget.cpp @@ -25,8 +25,6 @@ #include "panelswidget.h" -#include "propertiespanel.h" - #include #include #include @@ -122,7 +120,6 @@ PanelsWidget::PanelsWidget(QWidget *parent) : pal.setColor(QPalette::All, QPalette::Window, background); m_root->setPalette(pal); - m_scroller = new QScrollArea(this); m_scroller->setWidget(m_root); m_scroller->setFrameStyle(QFrame::NoFrame); @@ -152,7 +149,6 @@ PanelsWidget::PanelsWidget(QWidget *parent) : PanelsWidget::~PanelsWidget() { - qDeleteAll(m_panels); } /* @@ -168,23 +164,21 @@ PanelsWidget::~PanelsWidget() * | | widget (with contentsmargins adjusted!) | * +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN */ -void PanelsWidget::addPropertiesPanel(PropertiesPanel *panel) +void PanelsWidget::addPropertiesPanel(const QString &displayName, const QIcon &icon, QWidget *widget) { - QTC_ASSERT(panel, return); - const int headerRow = m_layout->rowCount(); // icon: - if (!panel->icon().isNull()) { + if (!icon.isNull()) { auto iconLabel = new QLabel(m_root); - iconLabel->setPixmap(panel->icon().pixmap(ICON_SIZE, ICON_SIZE)); + iconLabel->setPixmap(icon.pixmap(ICON_SIZE, ICON_SIZE)); iconLabel->setContentsMargins(0, ABOVE_HEADING_MARGIN, 0, 0); m_layout->addWidget(iconLabel, headerRow, 0, 3, 1, Qt::AlignTop | Qt::AlignHCenter); } // name: auto nameLabel = new QLabel(m_root); - nameLabel->setText(panel->displayName()); + nameLabel->setText(displayName); QPalette palette = nameLabel->palette(); for (int i = QPalette::Active; i < QPalette::NColorGroups; ++i ) { // FIXME: theming @@ -201,23 +195,16 @@ void PanelsWidget::addPropertiesPanel(PropertiesPanel *panel) m_layout->addWidget(nameLabel, headerRow, 1, 1, 1, Qt::AlignVCenter | Qt::AlignLeft); // line: - const int lineRow(headerRow + 1); + const int lineRow = headerRow + 1; auto line = new OnePixelBlackLine(m_root); m_layout->addWidget(line, lineRow, 1, 1, -1, Qt::AlignTop); // add the widget: - const int widgetRow(lineRow + 1); - addPanelWidget(panel, widgetRow); -} + const int widgetRow = lineRow + 1; -void PanelsWidget::addPanelWidget(PropertiesPanel *panel, int row) -{ - QWidget *widget = panel->widget(); widget->setContentsMargins(PANEL_LEFT_MARGIN, ABOVE_CONTENTS_MARGIN, 0, BELOW_CONTENTS_MARGIN); widget->setParent(m_root); - m_layout->addWidget(widget, row, 0, 1, 2); - - m_panels.append(panel); + m_layout->addWidget(widget, widgetRow, 0, 1, 2); } diff --git a/src/plugins/projectexplorer/panelswidget.h b/src/plugins/projectexplorer/panelswidget.h index a336c897716..ba4ffb2692b 100644 --- a/src/plugins/projectexplorer/panelswidget.h +++ b/src/plugins/projectexplorer/panelswidget.h @@ -31,25 +31,23 @@ QT_BEGIN_NAMESPACE class QGridLayout; +class QIcon; QT_END_NAMESPACE namespace ProjectExplorer { -class PropertiesPanel; class PROJECTEXPLORER_EXPORT PanelsWidget : public QWidget { Q_OBJECT + public: explicit PanelsWidget(QWidget *parent = nullptr); ~PanelsWidget() override; - // Adds a widget - void addPropertiesPanel(PropertiesPanel *panel); + void addPropertiesPanel(const QString &displayName, const QIcon &icon, + QWidget *widget); private: - void addPanelWidget(PropertiesPanel *panel, int row); - - QList m_panels; QGridLayout *m_layout; QScrollArea *m_scroller; QWidget *m_root; diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index 1aa114ce5c0..e8bace07de9 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.pro @@ -142,7 +142,6 @@ HEADERS += projectexplorer.h \ ipotentialkit.h \ selectablefilesmodel.h \ xcodebuildparser.h \ - propertiespanel.h \ panelswidget.h \ projectwelcomepage.h \ sessionmodel.h \ @@ -283,7 +282,6 @@ SOURCES += projectexplorer.cpp \ customparserconfigdialog.cpp \ selectablefilesmodel.cpp \ xcodebuildparser.cpp \ - propertiespanel.cpp \ panelswidget.cpp \ projectwelcomepage.cpp \ sessionmodel.cpp \ diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs index 345f173ffff..7b82e8754fd 100644 --- a/src/plugins/projectexplorer/projectexplorer.qbs +++ b/src/plugins/projectexplorer/projectexplorer.qbs @@ -127,7 +127,6 @@ Project { "projecttreewidget.cpp", "projecttreewidget.h", "projectwindow.cpp", "projectwindow.h", "projectwizardpage.cpp", "projectwizardpage.h", "projectwizardpage.ui", - "propertiespanel.cpp", "propertiespanel.h", "removetaskhandler.cpp", "removetaskhandler.h", "runnables.cpp", "runnables.h", "runconfiguration.cpp", "runconfiguration.h", diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index a9bb5cee2b5..922c335aeba 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -31,7 +31,6 @@ #include "project.h" #include "projectexplorer.h" #include "projectpanelfactory.h" -#include "propertiespanel.h" #include "session.h" #include "target.h" #include "targetsettingspanel.h" @@ -97,12 +96,10 @@ QVariant MiscSettingsPanelItem::data(int column, int role) const if (role == PanelWidgetRole) { if (!m_widget) { auto panelsWidget = new PanelsWidget; - auto panel = new PropertiesPanel; - panel->setDisplayName(m_factory->displayName()); QWidget *widget = m_factory->createWidget(m_project); - panel->setWidget(widget); - panel->setIcon(QIcon(m_factory->icon())); - panelsWidget->addPropertiesPanel(panel); + panelsWidget->addPropertiesPanel(m_factory->displayName(), + QIcon(m_factory->icon()), + widget); panelsWidget->setFocusProxy(widget); m_widget = panelsWidget; } diff --git a/src/plugins/projectexplorer/propertiespanel.cpp b/src/plugins/projectexplorer/propertiespanel.cpp deleted file mode 100644 index 270e18d8891..00000000000 --- a/src/plugins/projectexplorer/propertiespanel.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "propertiespanel.h" diff --git a/src/plugins/projectexplorer/propertiespanel.h b/src/plugins/projectexplorer/propertiespanel.h deleted file mode 100644 index 0f7e284c4a7..00000000000 --- a/src/plugins/projectexplorer/propertiespanel.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include "projectexplorer_export.h" - -#include -#include - -namespace ProjectExplorer { - -class PROJECTEXPLORER_EXPORT PropertiesPanel -{ - Q_DISABLE_COPY(PropertiesPanel) - -public: - PropertiesPanel() = default; - ~PropertiesPanel() { delete m_widget; } - - QString displayName() const { return m_displayName; } - QIcon icon() const { return m_icon; } - QWidget *widget() const { return m_widget; } - - void setDisplayName(const QString &name) { m_displayName = name; } - void setIcon(const QIcon &icon) { m_icon = icon; } - void setWidget(QWidget *widget) { m_widget = widget; } - -private: - QString m_displayName; - QWidget *m_widget = nullptr; - QIcon m_icon; -}; - -} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index eec9f3fdd0d..a7e827ed529 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -39,7 +39,6 @@ #include "projectimporter.h" #include "projecttree.h" #include "projectwindow.h" -#include "propertiespanel.h" #include "runsettingspropertiespage.h" #include "session.h" #include "target.h" @@ -257,29 +256,25 @@ void TargetGroupItemPrivate::ensureWidget() if (!m_configurePage) { auto panelsWidget = new PanelsWidget; - auto panel = new PropertiesPanel; - panel->setDisplayName(tr("Configure Project")); auto widget = new TargetSetupPageWrapper(m_project); - panel->setWidget(widget); - panel->setIcon(QIcon(":/projectexplorer/images/unconfigured.png")); - panelsWidget->addPropertiesPanel(panel); + panelsWidget->addPropertiesPanel(tr("Configure Project"), + QIcon(":/projectexplorer/images/unconfigured.png"), + widget); panelsWidget->setFocusProxy(widget); m_configurePage = panelsWidget; } if (!m_configuredPage) { auto panelsWidget = new PanelsWidget; - auto panel = new PropertiesPanel; - panel->setDisplayName(tr("Configure Project")); 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); - panel->setWidget(widget); - panel->setIcon(QIcon(":/projectexplorer/images/unconfigured.png")); - panelsWidget->addPropertiesPanel(panel); + panelsWidget->addPropertiesPanel(tr("Configure Project"), + QIcon(":/projectexplorer/images/unconfigured.png"), + widget); m_configuredPage = panelsWidget; } } @@ -605,18 +600,14 @@ public: static QWidget *createPanelWidget(QWidget *widget, const QString &displayName, const QString &icon) { - auto panel = new PropertiesPanel; auto w = new QWidget(); auto l = new QVBoxLayout(w); l->addWidget(widget); l->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); l->setContentsMargins(QMargins()); - panel->setWidget(w); - panel->setIcon(QIcon(icon)); - panel->setDisplayName(displayName); auto result = new PanelsWidget; - result->addPropertiesPanel(panel); + result->addPropertiesPanel(displayName, QIcon(icon), w); return result; } diff --git a/src/plugins/todo/todoplugin.cpp b/src/plugins/todo/todoplugin.cpp index dc4992e3b9e..b99ec94bd17 100644 --- a/src/plugins/todo/todoplugin.cpp +++ b/src/plugins/todo/todoplugin.cpp @@ -37,7 +37,6 @@ #include #include -#include #include #include