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 <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2022-09-06 17:43:30 +02:00
parent 8aee8df4df
commit c13a2c861f
2 changed files with 12 additions and 10 deletions

View File

@@ -5,6 +5,7 @@
#include <utils/layoutbuilder.h> #include <utils/layoutbuilder.h>
#include <utils/theme/theme.h> #include <utils/theme/theme.h>
#include <utils/utilsicons.h>
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QApplication> #include <QApplication>
@@ -16,6 +17,7 @@
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QListView> #include <QListView>
#include <QPushButton>
#include <QSpacerItem> #include <QSpacerItem>
#include <QToolButton> #include <QToolButton>
@@ -135,11 +137,10 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) :
return tb; return tb;
}; };
auto eraseButton = [] (const QString &toolTip) { auto unsetButton = [](const QString &toolTip) {
auto tb = new QToolButton; auto tb = new QPushButton;
tb->setText("x");
tb->setToolTip(toolTip); tb->setToolTip(toolTip);
tb->setArrowType(Qt::LeftArrow); tb->setText(tr("Unset"));
return tb; return tb;
}; };
@@ -176,10 +177,10 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) :
m_foregroundLabel = new QLabel(tr("Foreground:")); m_foregroundLabel = new QLabel(tr("Foreground:"));
m_foregroundToolButton = colorButton(); m_foregroundToolButton = colorButton();
m_eraseForegroundToolButton = eraseButton(tr("Erase foreground.")); m_eraseForegroundToolButton = unsetButton(tr("Unset foreground."));
m_backgroundLabel = new QLabel(tr("Background:")); m_backgroundLabel = new QLabel(tr("Background:"));
m_backgroundToolButton = colorButton(); m_backgroundToolButton = colorButton();
m_eraseBackgroundToolButton = eraseButton(tr("Erase background.")); m_eraseBackgroundToolButton = unsetButton(tr("Unset background."));
m_relativeForegroundHeadline = headlineLabel(tr("Relative Foreground")); m_relativeForegroundHeadline = headlineLabel(tr("Relative Foreground"));
m_foregroundSaturationLabel = new QLabel(tr("Saturation:")); m_foregroundSaturationLabel = new QLabel(tr("Saturation:"));
@@ -200,7 +201,7 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) :
m_underlineHeadline = headlineLabel(tr("Underline")); m_underlineHeadline = headlineLabel(tr("Underline"));
m_underlineLabel = new QLabel(tr("Color:")); m_underlineLabel = new QLabel(tr("Color:"));
m_underlineColorToolButton = colorButton(); m_underlineColorToolButton = colorButton();
m_eraseUnderlineColorToolButton = eraseButton(tr("Erase background.")); m_eraseUnderlineColorToolButton = unsetButton(tr("Unset background."));
m_underlineComboBox = new QComboBox; m_underlineComboBox = new QComboBox;
m_itemList->setModel(m_formatsModel); m_itemList->setModel(m_formatsModel);

View File

@@ -9,6 +9,7 @@
#include <QDialog> #include <QDialog>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAbstractButton;
class QCheckBox; class QCheckBox;
class QComboBox; class QComboBox;
class QDoubleSpinBox; class QDoubleSpinBox;
@@ -80,10 +81,10 @@ private:
QWidget *m_fontProperties; QWidget *m_fontProperties;
QLabel *m_foregroundLabel; QLabel *m_foregroundLabel;
QToolButton *m_foregroundToolButton; QToolButton *m_foregroundToolButton;
QToolButton *m_eraseForegroundToolButton; QAbstractButton *m_eraseForegroundToolButton;
QLabel *m_backgroundLabel; QLabel *m_backgroundLabel;
QToolButton *m_backgroundToolButton; QToolButton *m_backgroundToolButton;
QToolButton *m_eraseBackgroundToolButton; QAbstractButton *m_eraseBackgroundToolButton;
QLabel *m_relativeForegroundHeadline; QLabel *m_relativeForegroundHeadline;
QLabel *m_foregroundLightnessLabel; QLabel *m_foregroundLightnessLabel;
QDoubleSpinBox *m_foregroundLightnessSpinBox; QDoubleSpinBox *m_foregroundLightnessSpinBox;
@@ -100,7 +101,7 @@ private:
QLabel *m_underlineHeadline; QLabel *m_underlineHeadline;
QLabel *m_underlineLabel; QLabel *m_underlineLabel;
QToolButton *m_underlineColorToolButton; QToolButton *m_underlineColorToolButton;
QToolButton *m_eraseUnderlineColorToolButton; QAbstractButton *m_eraseUnderlineColorToolButton;
QComboBox *m_underlineComboBox; QComboBox *m_underlineComboBox;
}; };