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/theme/theme.h>
#include <utils/utilsicons.h>
#include <QAbstractListModel>
#include <QApplication>
@@ -16,6 +17,7 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QListView>
#include <QPushButton>
#include <QSpacerItem>
#include <QToolButton>
@@ -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);

View File

@@ -9,6 +9,7 @@
#include <QDialog>
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;
};