forked from qt-creator/qt-creator
ProjectExplorer: Remove Icon from main panel
Only a few panels come with an icon, and then the icon is unthemed and only for standard dpi (original design file is unavailable). The gained space benefits the vertical output pane on the right. Fixes: QTCREATORBUG-21917 Change-Id: Ie717ee7a08cbd21292a8e051c41406df58cad6d6 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 932 B |
Binary file not shown.
Before Width: | Height: | Size: 932 B |
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB |
@@ -40,12 +40,9 @@ using namespace Utils;
|
|||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const int ICON_SIZE(64);
|
|
||||||
|
|
||||||
const int ABOVE_HEADING_MARGIN = 10;
|
const int ABOVE_HEADING_MARGIN = 10;
|
||||||
const int ABOVE_CONTENTS_MARGIN = 4;
|
const int ABOVE_CONTENTS_MARGIN = 4;
|
||||||
const int BELOW_CONTENTS_MARGIN = 16;
|
const int BELOW_CONTENTS_MARGIN = 16;
|
||||||
const int PANEL_LEFT_MARGIN = 70;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +54,7 @@ PanelsWidget::PanelsWidget(QWidget *parent) : QWidget(parent)
|
|||||||
{
|
{
|
||||||
m_root = new QWidget(nullptr);
|
m_root = new QWidget(nullptr);
|
||||||
m_root->setFocusPolicy(Qt::NoFocus);
|
m_root->setFocusPolicy(Qt::NoFocus);
|
||||||
m_root->setContentsMargins(0, 0, 40, 0);
|
m_root->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
const auto scroller = new QScrollArea(this);
|
const auto scroller = new QScrollArea(this);
|
||||||
scroller->setWidget(m_root);
|
scroller->setWidget(m_root);
|
||||||
@@ -67,11 +64,10 @@ PanelsWidget::PanelsWidget(QWidget *parent) : QWidget(parent)
|
|||||||
|
|
||||||
// The layout holding the individual panels:
|
// The layout holding the individual panels:
|
||||||
auto topLayout = new QVBoxLayout(m_root);
|
auto topLayout = new QVBoxLayout(m_root);
|
||||||
topLayout->setContentsMargins(0, 0, 0, 0);
|
topLayout->setContentsMargins(PanelVMargin, 0, PanelVMargin, 0);
|
||||||
topLayout->setSpacing(0);
|
topLayout->setSpacing(0);
|
||||||
|
|
||||||
m_layout = new QGridLayout;
|
m_layout = new QVBoxLayout;
|
||||||
m_layout->setColumnMinimumWidth(0, ICON_SIZE + 4);
|
|
||||||
m_layout->setSpacing(0);
|
m_layout->setSpacing(0);
|
||||||
|
|
||||||
topLayout->addLayout(m_layout);
|
topLayout->addLayout(m_layout);
|
||||||
@@ -86,39 +82,28 @@ PanelsWidget::PanelsWidget(QWidget *parent) : QWidget(parent)
|
|||||||
//layout->addWidget(new FindToolBarPlaceHolder(this));
|
//layout->addWidget(new FindToolBarPlaceHolder(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelsWidget::PanelsWidget(const QString &displayName, const QIcon &icon, QWidget *widget)
|
PanelsWidget::PanelsWidget(const QString &displayName, QWidget *widget)
|
||||||
: PanelsWidget(nullptr)
|
: PanelsWidget(nullptr)
|
||||||
{
|
{
|
||||||
addPropertiesPanel(displayName, icon, widget);
|
addPropertiesPanel(displayName, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelsWidget::~PanelsWidget() = default;
|
PanelsWidget::~PanelsWidget() = default;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a widget with heading information into the grid
|
* Add a widget with heading information into the layout of the PanelsWidget.
|
||||||
* layout of the PanelsWidget.
|
|
||||||
*
|
*
|
||||||
* ...
|
* ...
|
||||||
* +--------+-------------------------------------------+ ABOVE_HEADING_MARGIN
|
* +------------+ ABOVE_HEADING_MARGIN
|
||||||
* | icon | name |
|
* | name |
|
||||||
* + +-------------------------------------------+
|
* +------------+
|
||||||
* | | line |
|
* | line |
|
||||||
* + +-------------------------------------------+ ABOVE_CONTENTS_MARGIN
|
* +------------+ ABOVE_CONTENTS_MARGIN
|
||||||
* | | widget (with contentsmargins adjusted!) |
|
* | widget |
|
||||||
* +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN
|
* +------------+ BELOW_CONTENTS_MARGIN
|
||||||
*/
|
*/
|
||||||
void PanelsWidget::addPropertiesPanel(const QString &displayName, const QIcon &icon, QWidget *widget)
|
void PanelsWidget::addPropertiesPanel(const QString &displayName, QWidget *widget)
|
||||||
{
|
{
|
||||||
const int headerRow = m_layout->rowCount();
|
|
||||||
|
|
||||||
// icon:
|
|
||||||
if (!icon.isNull()) {
|
|
||||||
auto iconLabel = new QLabel(m_root);
|
|
||||||
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:
|
// name:
|
||||||
auto nameLabel = new QLabel(m_root);
|
auto nameLabel = new QLabel(m_root);
|
||||||
nameLabel->setText(displayName);
|
nameLabel->setText(displayName);
|
||||||
@@ -127,24 +112,19 @@ void PanelsWidget::addPropertiesPanel(const QString &displayName, const QIcon &i
|
|||||||
f.setBold(true);
|
f.setBold(true);
|
||||||
f.setPointSizeF(f.pointSizeF() * 1.6);
|
f.setPointSizeF(f.pointSizeF() * 1.6);
|
||||||
nameLabel->setFont(f);
|
nameLabel->setFont(f);
|
||||||
m_layout->addWidget(nameLabel, headerRow, 1, 1, 1, Qt::AlignVCenter | Qt::AlignLeft);
|
m_layout->addWidget(nameLabel);
|
||||||
|
|
||||||
// line:
|
// line:
|
||||||
const int lineRow = headerRow + 1;
|
|
||||||
auto line = new QFrame(m_root);
|
auto line = new QFrame(m_root);
|
||||||
line->setFrameShape(QFrame::HLine);
|
line->setFrameShape(QFrame::HLine);
|
||||||
line->setForegroundRole(QPalette::Midlight);
|
line->setForegroundRole(QPalette::Midlight);
|
||||||
line->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
line->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
m_layout->addWidget(line, lineRow, 1, 1, -1, Qt::AlignTop);
|
m_layout->addWidget(line);
|
||||||
|
|
||||||
// add the widget:
|
// add the widget:
|
||||||
const int widgetRow = lineRow + 1;
|
widget->setContentsMargins(0, ABOVE_CONTENTS_MARGIN, 0, BELOW_CONTENTS_MARGIN);
|
||||||
|
|
||||||
widget->setContentsMargins(PANEL_LEFT_MARGIN,
|
|
||||||
ABOVE_CONTENTS_MARGIN, 0,
|
|
||||||
BELOW_CONTENTS_MARGIN);
|
|
||||||
widget->setParent(m_root);
|
widget->setParent(m_root);
|
||||||
m_layout->addWidget(widget, widgetRow, 0, 1, 2);
|
m_layout->addWidget(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ProjectExplorer
|
} // ProjectExplorer
|
||||||
|
@@ -30,8 +30,7 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QGridLayout;
|
class QVBoxLayout;
|
||||||
class QIcon;
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
@@ -42,15 +41,15 @@ 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,
|
PanelsWidget(const QString &displayName, QWidget *widget);
|
||||||
QWidget *widget);
|
|
||||||
~PanelsWidget() override;
|
~PanelsWidget() override;
|
||||||
|
|
||||||
void addPropertiesPanel(const QString &displayName, const QIcon &icon,
|
void addPropertiesPanel(const QString &displayName, QWidget *widget);
|
||||||
QWidget *widget);
|
|
||||||
|
static int constexpr PanelVMargin = 14;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QGridLayout *m_layout;
|
QVBoxLayout *m_layout;
|
||||||
QWidget *m_root;
|
QWidget *m_root;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -882,21 +882,18 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
auto panelFactory = new ProjectPanelFactory;
|
auto panelFactory = new ProjectPanelFactory;
|
||||||
panelFactory->setPriority(30);
|
panelFactory->setPriority(30);
|
||||||
panelFactory->setDisplayName(QCoreApplication::translate("EditorSettingsPanelFactory", "Editor"));
|
panelFactory->setDisplayName(QCoreApplication::translate("EditorSettingsPanelFactory", "Editor"));
|
||||||
panelFactory->setIcon(":/projectexplorer/images/EditorSettings.png");
|
|
||||||
panelFactory->setCreateWidgetFunction([](Project *project) { return new EditorSettingsWidget(project); });
|
panelFactory->setCreateWidgetFunction([](Project *project) { return new EditorSettingsWidget(project); });
|
||||||
ProjectPanelFactory::registerFactory(panelFactory);
|
ProjectPanelFactory::registerFactory(panelFactory);
|
||||||
|
|
||||||
panelFactory = new ProjectPanelFactory;
|
panelFactory = new ProjectPanelFactory;
|
||||||
panelFactory->setPriority(40);
|
panelFactory->setPriority(40);
|
||||||
panelFactory->setDisplayName(QCoreApplication::translate("CodeStyleSettingsPanelFactory", "Code Style"));
|
panelFactory->setDisplayName(QCoreApplication::translate("CodeStyleSettingsPanelFactory", "Code Style"));
|
||||||
panelFactory->setIcon(":/projectexplorer/images/CodeStyleSettings.png");
|
|
||||||
panelFactory->setCreateWidgetFunction([](Project *project) { return new CodeStyleSettingsWidget(project); });
|
panelFactory->setCreateWidgetFunction([](Project *project) { return new CodeStyleSettingsWidget(project); });
|
||||||
ProjectPanelFactory::registerFactory(panelFactory);
|
ProjectPanelFactory::registerFactory(panelFactory);
|
||||||
|
|
||||||
panelFactory = new ProjectPanelFactory;
|
panelFactory = new ProjectPanelFactory;
|
||||||
panelFactory->setPriority(50);
|
panelFactory->setPriority(50);
|
||||||
panelFactory->setDisplayName(QCoreApplication::translate("DependenciesPanelFactory", "Dependencies"));
|
panelFactory->setDisplayName(QCoreApplication::translate("DependenciesPanelFactory", "Dependencies"));
|
||||||
panelFactory->setIcon(":/projectexplorer/images/ProjectDependencies.png");
|
|
||||||
panelFactory->setCreateWidgetFunction([](Project *project) { return new DependenciesWidget(project); });
|
panelFactory->setCreateWidgetFunction([](Project *project) { return new DependenciesWidget(project); });
|
||||||
ProjectPanelFactory::registerFactory(panelFactory);
|
ProjectPanelFactory::registerFactory(panelFactory);
|
||||||
|
|
||||||
|
@@ -24,11 +24,6 @@
|
|||||||
<file>images/debugger_overlay_small@2x.png</file>
|
<file>images/debugger_overlay_small@2x.png</file>
|
||||||
<file>images/analyzer_overlay_small.png</file>
|
<file>images/analyzer_overlay_small.png</file>
|
||||||
<file>images/analyzer_overlay_small@2x.png</file>
|
<file>images/analyzer_overlay_small@2x.png</file>
|
||||||
<file>images/BuildSettings.png</file>
|
|
||||||
<file>images/CodeStyleSettings.png</file>
|
|
||||||
<file>images/RunSettings.png</file>
|
|
||||||
<file>images/EditorSettings.png</file>
|
|
||||||
<file>images/ProjectDependencies.png</file>
|
|
||||||
<file>images/devicestatusindicator.png</file>
|
<file>images/devicestatusindicator.png</file>
|
||||||
<file>images/devicestatusindicator@2x.png</file>
|
<file>images/devicestatusindicator@2x.png</file>
|
||||||
<file>images/build.png</file>
|
<file>images/build.png</file>
|
||||||
@@ -51,7 +46,6 @@
|
|||||||
<file>images/buildstepmoveup@2x.png</file>
|
<file>images/buildstepmoveup@2x.png</file>
|
||||||
<file>images/buildstepremove.png</file>
|
<file>images/buildstepremove.png</file>
|
||||||
<file>images/buildstepremove@2x.png</file>
|
<file>images/buildstepremove@2x.png</file>
|
||||||
<file>images/unconfigured.png</file>
|
|
||||||
<file>images/desktopdevice.png</file>
|
<file>images/desktopdevice.png</file>
|
||||||
<file>images/desktopdevice@2x.png</file>
|
<file>images/desktopdevice@2x.png</file>
|
||||||
<file>images/fileoverlay_qml.png</file>
|
<file>images/fileoverlay_qml.png</file>
|
||||||
|
@@ -90,16 +90,6 @@ void ProjectPanelFactory::setId(Utils::Id id)
|
|||||||
m_id = id;
|
m_id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProjectPanelFactory::icon() const
|
|
||||||
{
|
|
||||||
return m_icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProjectPanelFactory::setIcon(const QString &icon)
|
|
||||||
{
|
|
||||||
m_icon = icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *ProjectPanelFactory::createWidget(Project *project) const
|
QWidget *ProjectPanelFactory::createWidget(Project *project) const
|
||||||
{
|
{
|
||||||
return m_widgetCreator(project);
|
return m_widgetCreator(project);
|
||||||
|
@@ -72,9 +72,6 @@ public:
|
|||||||
|
|
||||||
Utils::TreeItem *createPanelItem(Project *project);
|
Utils::TreeItem *createPanelItem(Project *project);
|
||||||
|
|
||||||
QString icon() const;
|
|
||||||
void setIcon(const QString &icon);
|
|
||||||
|
|
||||||
void setCreateWidgetFunction(const WidgetCreator &createWidgetFunction);
|
void setCreateWidgetFunction(const WidgetCreator &createWidgetFunction);
|
||||||
QWidget *createWidget(Project *project) const;
|
QWidget *createWidget(Project *project) const;
|
||||||
|
|
||||||
@@ -87,7 +84,6 @@ private:
|
|||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
SupportsFunction m_supportsFunction;
|
SupportsFunction m_supportsFunction;
|
||||||
WidgetCreator m_widgetCreator;
|
WidgetCreator m_widgetCreator;
|
||||||
QString m_icon;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -262,9 +262,7 @@ QVariant MiscSettingsPanelItem::data(int column, int role) const
|
|||||||
if (role == PanelWidgetRole) {
|
if (role == PanelWidgetRole) {
|
||||||
if (!m_widget) {
|
if (!m_widget) {
|
||||||
QWidget *widget = m_factory->createWidget(m_project);
|
QWidget *widget = m_factory->createWidget(m_project);
|
||||||
m_widget = new PanelsWidget(m_factory->displayName(),
|
m_widget = new PanelsWidget(m_factory->displayName(), widget);
|
||||||
QIcon(m_factory->icon()),
|
|
||||||
widget);
|
|
||||||
m_widget->setFocusProxy(widget);
|
m_widget->setFocusProxy(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,7 +608,8 @@ public:
|
|||||||
|
|
||||||
auto innerLayout = new QVBoxLayout;
|
auto innerLayout = new QVBoxLayout;
|
||||||
innerLayout->setSpacing(10);
|
innerLayout->setSpacing(10);
|
||||||
innerLayout->setContentsMargins(14, innerLayout->spacing(), 14, 0);
|
innerLayout->setContentsMargins(PanelsWidget::PanelVMargin, innerLayout->spacing(),
|
||||||
|
PanelsWidget::PanelVMargin, 0);
|
||||||
innerLayout->addWidget(m_manageKits);
|
innerLayout->addWidget(m_manageKits);
|
||||||
innerLayout->addSpacerItem(new QSpacerItem(10, 30, QSizePolicy::Maximum, QSizePolicy::Maximum));
|
innerLayout->addSpacerItem(new QSpacerItem(10, 30, QSizePolicy::Maximum, QSizePolicy::Maximum));
|
||||||
innerLayout->addWidget(activeLabel);
|
innerLayout->addWidget(activeLabel);
|
||||||
|
@@ -229,9 +229,7 @@ void TargetGroupItemPrivate::ensureWidget()
|
|||||||
|
|
||||||
if (!m_configurePage) {
|
if (!m_configurePage) {
|
||||||
m_targetSetupPageWrapper = new TargetSetupPageWrapper(m_project);
|
m_targetSetupPageWrapper = new TargetSetupPageWrapper(m_project);
|
||||||
m_configurePage = new PanelsWidget(tr("Configure Project"),
|
m_configurePage = new PanelsWidget(tr("Configure Project"), m_targetSetupPageWrapper);
|
||||||
QIcon(":/projectexplorer/images/unconfigured.png"),
|
|
||||||
m_targetSetupPageWrapper);
|
|
||||||
m_configurePage->setFocusProxy(m_targetSetupPageWrapper);
|
m_configurePage->setFocusProxy(m_targetSetupPageWrapper);
|
||||||
}
|
}
|
||||||
m_targetSetupPageWrapper->ensureSetupPage();
|
m_targetSetupPageWrapper->ensureSetupPage();
|
||||||
@@ -243,9 +241,7 @@ void TargetGroupItemPrivate::ensureWidget()
|
|||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->addWidget(label);
|
layout->addWidget(label);
|
||||||
layout->addStretch(10);
|
layout->addStretch(10);
|
||||||
m_configuredPage = new PanelsWidget(tr("Configure Project"),
|
m_configuredPage = new PanelsWidget(tr("Configure Project"), widget);
|
||||||
QIcon(":/projectexplorer/images/unconfigured.png"),
|
|
||||||
widget);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,10 +610,8 @@ public:
|
|||||||
if (!m_panel) {
|
if (!m_panel) {
|
||||||
m_panel = (m_subIndex == RunPage)
|
m_panel = (m_subIndex == RunPage)
|
||||||
? new PanelsWidget(RunSettingsWidget::tr("Run Settings"),
|
? new PanelsWidget(RunSettingsWidget::tr("Run Settings"),
|
||||||
QIcon(":/projectexplorer/images/RunSettings.png"),
|
|
||||||
new RunSettingsWidget(target()))
|
new RunSettingsWidget(target()))
|
||||||
: new PanelsWidget(QCoreApplication::translate("BuildSettingsPanel", "Build Settings"),
|
: new PanelsWidget(QCoreApplication::translate("BuildSettingsPanel", "Build Settings"),
|
||||||
QIcon(":/projectexplorer/images/BuildSettings.png"),
|
|
||||||
new BuildSettingsWidget(target()));
|
new BuildSettingsWidget(target()));
|
||||||
}
|
}
|
||||||
return m_panel;
|
return m_panel;
|
||||||
|
@@ -334,20 +334,8 @@ void IconLister::addProjectExplorerIcons()
|
|||||||
|
|
||||||
{QIcon(":/projectexplorer/images/category_buildrun.png"), "category_buildrun.png", prefix,
|
{QIcon(":/projectexplorer/images/category_buildrun.png"), "category_buildrun.png", prefix,
|
||||||
""},
|
""},
|
||||||
{QIcon(":/projectexplorer/images/BuildSettings.png"), "BuildSettings.png", prefix,
|
|
||||||
""},
|
|
||||||
{QIcon(":/projectexplorer/images/CodeStyleSettings.png"), "CodeStyleSettings.png", prefix,
|
|
||||||
""},
|
|
||||||
{QIcon(":/projectexplorer/images/RunSettings.png"), "RunSettings.png", prefix,
|
|
||||||
""},
|
|
||||||
{QIcon(":/projectexplorer/images/EditorSettings.png"), "EditorSettings.png", prefix,
|
|
||||||
""},
|
|
||||||
{QIcon(":/projectexplorer/images/ProjectDependencies.png"), "ProjectDependencies.png", prefix,
|
|
||||||
""},
|
|
||||||
{QIcon(":/projectexplorer/images/targetpanel_bottom.png"), "targetpanel_bottom.png", prefix,
|
{QIcon(":/projectexplorer/images/targetpanel_bottom.png"), "targetpanel_bottom.png", prefix,
|
||||||
""},
|
""},
|
||||||
{QIcon(":/projectexplorer/images/unconfigured.png"), "unconfigured.png", prefix,
|
|
||||||
""},
|
|
||||||
};
|
};
|
||||||
m_icons.append(icons);
|
m_icons.append(icons);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user