From c13a2c861fa8b1856164266c08476ec32c2fb28f Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 6 Sep 2022 17:43:30 +0200 Subject: [PATCH] TextEditor: Improve appearance of "erase" button in color scheme editor This removes the arrow icon which does not make much sense (and also looks bad on macOS) with the text "Unset". The tooltip gets adapted, accordingly. Change-Id: Ifdf41114855fe9e97d8a89a9865d92ae262e4dce Reviewed-by: Eike Ziller --- src/plugins/texteditor/colorschemeedit.cpp | 15 ++++++++------- src/plugins/texteditor/colorschemeedit.h | 7 ++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/plugins/texteditor/colorschemeedit.cpp b/src/plugins/texteditor/colorschemeedit.cpp index 64effb2cc6a..3d340d5c171 100644 --- a/src/plugins/texteditor/colorschemeedit.cpp +++ b/src/plugins/texteditor/colorschemeedit.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -16,6 +17,7 @@ #include #include #include +#include #include #include @@ -135,11 +137,10 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) : return tb; }; - auto eraseButton = [] (const QString &toolTip) { - auto tb = new QToolButton; - tb->setText("x"); + auto unsetButton = [](const QString &toolTip) { + auto tb = new QPushButton; tb->setToolTip(toolTip); - tb->setArrowType(Qt::LeftArrow); + tb->setText(tr("Unset")); return tb; }; @@ -176,10 +177,10 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) : m_foregroundLabel = new QLabel(tr("Foreground:")); m_foregroundToolButton = colorButton(); - m_eraseForegroundToolButton = eraseButton(tr("Erase foreground.")); + m_eraseForegroundToolButton = unsetButton(tr("Unset foreground.")); m_backgroundLabel = new QLabel(tr("Background:")); m_backgroundToolButton = colorButton(); - m_eraseBackgroundToolButton = eraseButton(tr("Erase background.")); + m_eraseBackgroundToolButton = unsetButton(tr("Unset background.")); m_relativeForegroundHeadline = headlineLabel(tr("Relative Foreground")); m_foregroundSaturationLabel = new QLabel(tr("Saturation:")); @@ -200,7 +201,7 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) : m_underlineHeadline = headlineLabel(tr("Underline")); m_underlineLabel = new QLabel(tr("Color:")); m_underlineColorToolButton = colorButton(); - m_eraseUnderlineColorToolButton = eraseButton(tr("Erase background.")); + m_eraseUnderlineColorToolButton = unsetButton(tr("Unset background.")); m_underlineComboBox = new QComboBox; m_itemList->setModel(m_formatsModel); diff --git a/src/plugins/texteditor/colorschemeedit.h b/src/plugins/texteditor/colorschemeedit.h index 2c4a9e65585..f0114840785 100644 --- a/src/plugins/texteditor/colorschemeedit.h +++ b/src/plugins/texteditor/colorschemeedit.h @@ -9,6 +9,7 @@ #include QT_BEGIN_NAMESPACE +class QAbstractButton; class QCheckBox; class QComboBox; class QDoubleSpinBox; @@ -80,10 +81,10 @@ private: QWidget *m_fontProperties; QLabel *m_foregroundLabel; QToolButton *m_foregroundToolButton; - QToolButton *m_eraseForegroundToolButton; + QAbstractButton *m_eraseForegroundToolButton; QLabel *m_backgroundLabel; QToolButton *m_backgroundToolButton; - QToolButton *m_eraseBackgroundToolButton; + QAbstractButton *m_eraseBackgroundToolButton; QLabel *m_relativeForegroundHeadline; QLabel *m_foregroundLightnessLabel; QDoubleSpinBox *m_foregroundLightnessSpinBox; @@ -100,7 +101,7 @@ private: QLabel *m_underlineHeadline; QLabel *m_underlineLabel; QToolButton *m_underlineColorToolButton; - QToolButton *m_eraseUnderlineColorToolButton; + QAbstractButton *m_eraseUnderlineColorToolButton; QComboBox *m_underlineComboBox; };