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 {
|
||||
|
||||
const int ICON_SIZE(64);
|
||||
|
||||
const int ABOVE_HEADING_MARGIN = 10;
|
||||
const int ABOVE_CONTENTS_MARGIN = 4;
|
||||
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->setFocusPolicy(Qt::NoFocus);
|
||||
m_root->setContentsMargins(0, 0, 40, 0);
|
||||
m_root->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
const auto scroller = new QScrollArea(this);
|
||||
scroller->setWidget(m_root);
|
||||
@@ -67,11 +64,10 @@ PanelsWidget::PanelsWidget(QWidget *parent) : QWidget(parent)
|
||||
|
||||
// The layout holding the individual panels:
|
||||
auto topLayout = new QVBoxLayout(m_root);
|
||||
topLayout->setContentsMargins(0, 0, 0, 0);
|
||||
topLayout->setContentsMargins(PanelVMargin, 0, PanelVMargin, 0);
|
||||
topLayout->setSpacing(0);
|
||||
|
||||
m_layout = new QGridLayout;
|
||||
m_layout->setColumnMinimumWidth(0, ICON_SIZE + 4);
|
||||
m_layout = new QVBoxLayout;
|
||||
m_layout->setSpacing(0);
|
||||
|
||||
topLayout->addLayout(m_layout);
|
||||
@@ -86,39 +82,28 @@ PanelsWidget::PanelsWidget(QWidget *parent) : QWidget(parent)
|
||||
//layout->addWidget(new FindToolBarPlaceHolder(this));
|
||||
}
|
||||
|
||||
PanelsWidget::PanelsWidget(const QString &displayName, const QIcon &icon, QWidget *widget)
|
||||
PanelsWidget::PanelsWidget(const QString &displayName, QWidget *widget)
|
||||
: PanelsWidget(nullptr)
|
||||
{
|
||||
addPropertiesPanel(displayName, icon, widget);
|
||||
addPropertiesPanel(displayName, widget);
|
||||
}
|
||||
|
||||
PanelsWidget::~PanelsWidget() = default;
|
||||
|
||||
/*
|
||||
* Add a widget with heading information into the grid
|
||||
* layout of the PanelsWidget.
|
||||
* Add a widget with heading information into the layout of the PanelsWidget.
|
||||
*
|
||||
* ...
|
||||
* +--------+-------------------------------------------+ ABOVE_HEADING_MARGIN
|
||||
* | icon | name |
|
||||
* + +-------------------------------------------+
|
||||
* | | line |
|
||||
* + +-------------------------------------------+ ABOVE_CONTENTS_MARGIN
|
||||
* | | widget (with contentsmargins adjusted!) |
|
||||
* +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN
|
||||
* +------------+ ABOVE_HEADING_MARGIN
|
||||
* | name |
|
||||
* +------------+
|
||||
* | line |
|
||||
* +------------+ ABOVE_CONTENTS_MARGIN
|
||||
* | widget |
|
||||
* +------------+ 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:
|
||||
auto nameLabel = new QLabel(m_root);
|
||||
nameLabel->setText(displayName);
|
||||
@@ -127,24 +112,19 @@ void PanelsWidget::addPropertiesPanel(const QString &displayName, const QIcon &i
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() * 1.6);
|
||||
nameLabel->setFont(f);
|
||||
m_layout->addWidget(nameLabel, headerRow, 1, 1, 1, Qt::AlignVCenter | Qt::AlignLeft);
|
||||
m_layout->addWidget(nameLabel);
|
||||
|
||||
// line:
|
||||
const int lineRow = headerRow + 1;
|
||||
auto line = new QFrame(m_root);
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setForegroundRole(QPalette::Midlight);
|
||||
line->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
m_layout->addWidget(line, lineRow, 1, 1, -1, Qt::AlignTop);
|
||||
m_layout->addWidget(line);
|
||||
|
||||
// add the widget:
|
||||
const int widgetRow = lineRow + 1;
|
||||
|
||||
widget->setContentsMargins(PANEL_LEFT_MARGIN,
|
||||
ABOVE_CONTENTS_MARGIN, 0,
|
||||
BELOW_CONTENTS_MARGIN);
|
||||
widget->setContentsMargins(0, ABOVE_CONTENTS_MARGIN, 0, BELOW_CONTENTS_MARGIN);
|
||||
widget->setParent(m_root);
|
||||
m_layout->addWidget(widget, widgetRow, 0, 1, 2);
|
||||
m_layout->addWidget(widget);
|
||||
}
|
||||
|
||||
} // ProjectExplorer
|
||||
|
@@ -30,8 +30,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QGridLayout;
|
||||
class QIcon;
|
||||
class QVBoxLayout;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -42,15 +41,15 @@ class PROJECTEXPLORER_EXPORT PanelsWidget : public QWidget
|
||||
|
||||
public:
|
||||
explicit PanelsWidget(QWidget *parent = nullptr);
|
||||
PanelsWidget(const QString &displayName, const QIcon &icon,
|
||||
QWidget *widget);
|
||||
PanelsWidget(const QString &displayName, QWidget *widget);
|
||||
~PanelsWidget() override;
|
||||
|
||||
void addPropertiesPanel(const QString &displayName, const QIcon &icon,
|
||||
QWidget *widget);
|
||||
void addPropertiesPanel(const QString &displayName, QWidget *widget);
|
||||
|
||||
static int constexpr PanelVMargin = 14;
|
||||
|
||||
private:
|
||||
QGridLayout *m_layout;
|
||||
QVBoxLayout *m_layout;
|
||||
QWidget *m_root;
|
||||
};
|
||||
|
||||
|
@@ -882,21 +882,18 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
auto panelFactory = new ProjectPanelFactory;
|
||||
panelFactory->setPriority(30);
|
||||
panelFactory->setDisplayName(QCoreApplication::translate("EditorSettingsPanelFactory", "Editor"));
|
||||
panelFactory->setIcon(":/projectexplorer/images/EditorSettings.png");
|
||||
panelFactory->setCreateWidgetFunction([](Project *project) { return new EditorSettingsWidget(project); });
|
||||
ProjectPanelFactory::registerFactory(panelFactory);
|
||||
|
||||
panelFactory = new ProjectPanelFactory;
|
||||
panelFactory->setPriority(40);
|
||||
panelFactory->setDisplayName(QCoreApplication::translate("CodeStyleSettingsPanelFactory", "Code Style"));
|
||||
panelFactory->setIcon(":/projectexplorer/images/CodeStyleSettings.png");
|
||||
panelFactory->setCreateWidgetFunction([](Project *project) { return new CodeStyleSettingsWidget(project); });
|
||||
ProjectPanelFactory::registerFactory(panelFactory);
|
||||
|
||||
panelFactory = new ProjectPanelFactory;
|
||||
panelFactory->setPriority(50);
|
||||
panelFactory->setDisplayName(QCoreApplication::translate("DependenciesPanelFactory", "Dependencies"));
|
||||
panelFactory->setIcon(":/projectexplorer/images/ProjectDependencies.png");
|
||||
panelFactory->setCreateWidgetFunction([](Project *project) { return new DependenciesWidget(project); });
|
||||
ProjectPanelFactory::registerFactory(panelFactory);
|
||||
|
||||
|
@@ -24,11 +24,6 @@
|
||||
<file>images/debugger_overlay_small@2x.png</file>
|
||||
<file>images/analyzer_overlay_small.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@2x.png</file>
|
||||
<file>images/build.png</file>
|
||||
@@ -51,7 +46,6 @@
|
||||
<file>images/buildstepmoveup@2x.png</file>
|
||||
<file>images/buildstepremove.png</file>
|
||||
<file>images/buildstepremove@2x.png</file>
|
||||
<file>images/unconfigured.png</file>
|
||||
<file>images/desktopdevice.png</file>
|
||||
<file>images/desktopdevice@2x.png</file>
|
||||
<file>images/fileoverlay_qml.png</file>
|
||||
|
@@ -90,16 +90,6 @@ void ProjectPanelFactory::setId(Utils::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
|
||||
{
|
||||
return m_widgetCreator(project);
|
||||
|
@@ -72,9 +72,6 @@ public:
|
||||
|
||||
Utils::TreeItem *createPanelItem(Project *project);
|
||||
|
||||
QString icon() const;
|
||||
void setIcon(const QString &icon);
|
||||
|
||||
void setCreateWidgetFunction(const WidgetCreator &createWidgetFunction);
|
||||
QWidget *createWidget(Project *project) const;
|
||||
|
||||
@@ -87,7 +84,6 @@ private:
|
||||
QString m_displayName;
|
||||
SupportsFunction m_supportsFunction;
|
||||
WidgetCreator m_widgetCreator;
|
||||
QString m_icon;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -262,9 +262,7 @@ QVariant MiscSettingsPanelItem::data(int column, int role) const
|
||||
if (role == PanelWidgetRole) {
|
||||
if (!m_widget) {
|
||||
QWidget *widget = m_factory->createWidget(m_project);
|
||||
m_widget = new PanelsWidget(m_factory->displayName(),
|
||||
QIcon(m_factory->icon()),
|
||||
widget);
|
||||
m_widget = new PanelsWidget(m_factory->displayName(), widget);
|
||||
m_widget->setFocusProxy(widget);
|
||||
}
|
||||
|
||||
@@ -610,7 +608,8 @@ public:
|
||||
|
||||
auto innerLayout = new QVBoxLayout;
|
||||
innerLayout->setSpacing(10);
|
||||
innerLayout->setContentsMargins(14, innerLayout->spacing(), 14, 0);
|
||||
innerLayout->setContentsMargins(PanelsWidget::PanelVMargin, innerLayout->spacing(),
|
||||
PanelsWidget::PanelVMargin, 0);
|
||||
innerLayout->addWidget(m_manageKits);
|
||||
innerLayout->addSpacerItem(new QSpacerItem(10, 30, QSizePolicy::Maximum, QSizePolicy::Maximum));
|
||||
innerLayout->addWidget(activeLabel);
|
||||
|
@@ -229,9 +229,7 @@ void TargetGroupItemPrivate::ensureWidget()
|
||||
|
||||
if (!m_configurePage) {
|
||||
m_targetSetupPageWrapper = new TargetSetupPageWrapper(m_project);
|
||||
m_configurePage = new PanelsWidget(tr("Configure Project"),
|
||||
QIcon(":/projectexplorer/images/unconfigured.png"),
|
||||
m_targetSetupPageWrapper);
|
||||
m_configurePage = new PanelsWidget(tr("Configure Project"), m_targetSetupPageWrapper);
|
||||
m_configurePage->setFocusProxy(m_targetSetupPageWrapper);
|
||||
}
|
||||
m_targetSetupPageWrapper->ensureSetupPage();
|
||||
@@ -243,9 +241,7 @@ void TargetGroupItemPrivate::ensureWidget()
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(label);
|
||||
layout->addStretch(10);
|
||||
m_configuredPage = new PanelsWidget(tr("Configure Project"),
|
||||
QIcon(":/projectexplorer/images/unconfigured.png"),
|
||||
widget);
|
||||
m_configuredPage = new PanelsWidget(tr("Configure Project"), widget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,10 +610,8 @@ public:
|
||||
if (!m_panel) {
|
||||
m_panel = (m_subIndex == RunPage)
|
||||
? new PanelsWidget(RunSettingsWidget::tr("Run Settings"),
|
||||
QIcon(":/projectexplorer/images/RunSettings.png"),
|
||||
new RunSettingsWidget(target()))
|
||||
: new PanelsWidget(QCoreApplication::translate("BuildSettingsPanel", "Build Settings"),
|
||||
QIcon(":/projectexplorer/images/BuildSettings.png"),
|
||||
new BuildSettingsWidget(target()));
|
||||
}
|
||||
return m_panel;
|
||||
|
@@ -334,20 +334,8 @@ void IconLister::addProjectExplorerIcons()
|
||||
|
||||
{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/unconfigured.png"), "unconfigured.png", prefix,
|
||||
""},
|
||||
};
|
||||
m_icons.append(icons);
|
||||
}
|
||||
|
Reference in New Issue
Block a user