Utils: Introduce Utils::Icons::PINNED_SMALL

Replaces two duplicated pin.xpm in the pinnable debugger tooltip and the
qmleditorwidgets with the new icon.

Change-Id: I57b7adc5c0b92ffdf01da12dd832482d739cb86e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Alessandro Portale
2023-03-29 15:58:56 +02:00
parent 73c645820f
commit cb3fd6eb0d
7 changed files with 9 additions and 51 deletions

View File

@@ -6,6 +6,7 @@
#include "qmleditorwidgetstr.h"
#include <utils/hostosinfo.h>
#include <utils/utilsicons.h>
#include <QToolButton>
#include <QFontComboBox>
@@ -27,26 +28,6 @@ using namespace Utils;
namespace QmlEditorWidgets {
/* XPM */
static const char * pin_xpm[] = {
"12 9 7 1",
" c None",
". c #000000",
"+ c #515151",
"@ c #A8A8A8",
"# c #A9A9A9",
"$ c #999999",
"% c #696969",
" . ",
" ......+",
" .@@@@@.",
" .#####.",
"+.....$$$$$.",
" .%%%%%.",
" .......",
" ......+",
" . "};
DragWidget::DragWidget(QWidget *parent) : QFrame(parent)
{
setFrameStyle(QFrame::NoFrame);
@@ -143,7 +124,7 @@ ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_cu
m_toolButton->setIcon(style()->standardIcon(QStyle::SP_DockWidgetCloseButton));
m_toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
m_toolButton->setFixedSize(16, 16);
m_toolButton->setFixedSize(20, 20);
m_toolButton->setToolTip(Tr::tr("Hides this toolbar."));
connect(m_toolButton, &QToolButton::clicked, this, &ContextPaneWidget::onTogglePane);
@@ -464,9 +445,7 @@ void ContextPaneWidget::setPinButton()
m_toolButton->setAutoRaise(true);
m_pinned = true;
m_toolButton->setIcon(QPixmap::fromImage(QImage(pin_xpm)));
m_toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
m_toolButton->setFixedSize(20, 20);
m_toolButton->setIcon(Utils::Icons::PINNED_SMALL.icon());
m_toolButton->setToolTip(Tr::tr("Unpins the toolbar and moves it to the default position."));
emit pinnedChanged(true);
@@ -481,8 +460,6 @@ void ContextPaneWidget::setLineButton()
m_pinned = false;
m_toolButton->setAutoRaise(true);
m_toolButton->setIcon(style()->standardIcon(QStyle::SP_DockWidgetCloseButton));
m_toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
m_toolButton->setFixedSize(20, 20);
m_toolButton->setToolTip(Tr::tr("Hides this toolbar. This toolbar can be"
" permanently disabled in the options page or in the context menu."));

View File

@@ -24,6 +24,8 @@ const Icon UNLOCKED({
{":/utils/images/unlocked.png", Theme::PanelTextColorDark}}, Icon::Tint);
const Icon PINNED({
{":/utils/images/pinned.png", Theme::PanelTextColorDark}}, Icon::Tint);
const Icon PINNED_SMALL({
{":/utils/images/pinned_small.png", Theme::PanelTextColorDark}}, Icon::Tint);
const Icon NEXT({
{":/utils/images/next.png", Theme::IconsWarningColor}}, Icon::MenuTintedStyle);
const Icon NEXT_TOOLBAR({

View File

@@ -19,6 +19,7 @@ QTCREATOR_UTILS_EXPORT extern const Icon LOCKED;
QTCREATOR_UTILS_EXPORT extern const Icon UNLOCKED_TOOLBAR;
QTCREATOR_UTILS_EXPORT extern const Icon UNLOCKED;
QTCREATOR_UTILS_EXPORT extern const Icon PINNED;
QTCREATOR_UTILS_EXPORT extern const Icon PINNED_SMALL;
QTCREATOR_UTILS_EXPORT extern const Icon NEXT;
QTCREATOR_UTILS_EXPORT extern const Icon NEXT_TOOLBAR;
QTCREATOR_UTILS_EXPORT extern const Icon PREV;

View File

@@ -175,7 +175,7 @@ Project {
Group {
name: "Images"
prefix: "images/"
files: ["*.png", "*.xpm"]
files: ["*.png"]
}
Group {

View File

@@ -42,7 +42,6 @@
<file>images/mode_debug@2x.png</file>
<file>images/mode_debug_mask.png</file>
<file>images/mode_debug_mask@2x.png</file>
<file>images/pin.xpm</file>
<file>images/debugger_restart_small.png</file>
<file>images/debugger_restart_small@2x.png</file>
<file>images/recordfill.png</file>

View File

@@ -519,7 +519,7 @@ DebuggerToolTipWidget::DebuggerToolTipWidget()
setAttribute(Qt::WA_DeleteOnClose);
isPinned = false;
const QIcon pinIcon(":/debugger/images/pin.xpm");
const QIcon pinIcon = Utils::Icons::PINNED_SMALL.icon();
pinButton = new QToolButton;
pinButton->setIcon(pinIcon);
@@ -534,9 +534,7 @@ DebuggerToolTipWidget::DebuggerToolTipWidget()
auto toolBar = new QToolBar(this);
toolBar->setProperty("_q_custom_style_disabled", QVariant(true));
const QList<QSize> pinIconSizes = pinIcon.availableSizes();
if (!pinIconSizes.isEmpty())
toolBar->setIconSize(pinIconSizes.front());
toolBar->setIconSize({12, 12});
toolBar->addWidget(pinButton);
toolBar->addWidget(copyButton);
toolBar->addWidget(titleLabel);

View File

@@ -1,19 +0,0 @@
/* XPM */
static const char * pin_xpm[] = {
"12 9 7 1",
" c None",
". c #000000",
"+ c #515151",
"@ c #A8A8A8",
"# c #A9A9A9",
"$ c #999999",
"% c #696969",
" . ",
" ......+",
" .@@@@@.",
" .#####.",
"+.....$$$$$.",
" .%%%%%.",
" .......",
" ......+",
" . "};