# HG changeset patch # User Teemu Piippo # Date 1680955899 -10800 # Node ID 5c655cc006deb6c962ce0594a815ea37e8bd7315 # Parent 3e3784c4cd3e3faf02aff29bbd167b8b7dda8293 Rename ColorButton -> ColorEdit diff -r 3e3784c4cd3e -r 5c655cc006de src/settingseditor/settingseditor.cpp --- a/src/settingseditor/settingseditor.cpp Sat Apr 08 15:08:19 2023 +0300 +++ b/src/settingseditor/settingseditor.cpp Sat Apr 08 15:11:39 2023 +0300 @@ -84,8 +84,8 @@ for (auto* widget : this->findChildren()) { connect(widget, qOverload(&QSpinBox::valueChanged), this, &SettingsEditor::saveSettings); } - for (auto* widget : this->findChildren()) { - connect(widget, &ColorButton::colorChanged, this, &SettingsEditor::saveSettings); + for (auto* widget : this->findChildren()) { + connect(widget, &ColorEdit::colorChanged, this, &SettingsEditor::saveSettings); } for (auto* widget : this->findChildren()) { connect(widget, qOverload(&QComboBox::currentIndexChanged), this, &SettingsEditor::saveSettings); diff -r 3e3784c4cd3e -r 5c655cc006de src/settingseditor/settingseditor.ui --- a/src/settingseditor/settingseditor.ui Sat Apr 08 15:08:19 2023 +0300 +++ b/src/settingseditor/settingseditor.ui Sat Apr 08 15:11:39 2023 +0300 @@ -117,7 +117,7 @@ - + @@ -127,7 +127,7 @@ - + @@ -137,7 +137,7 @@ - + @@ -251,7 +251,7 @@ - ColorButton + ColorEdit QPushButton
widgets/colorbutton.h
diff -r 3e3784c4cd3e -r 5c655cc006de widgets/colorbutton.cpp --- a/widgets/colorbutton.cpp Sat Apr 08 15:08:19 2023 +0300 +++ b/widgets/colorbutton.cpp Sat Apr 08 15:11:39 2023 +0300 @@ -2,13 +2,13 @@ #include #include "widgets/colorbutton.h" -ColorButton::ColorButton(const QColor& color, QWidget* parent) : - ColorButton{parent} +ColorEdit::ColorEdit(const QColor& color, QWidget* parent) : + ColorEdit{parent} { this->setColor(color); } -ColorButton::ColorButton(QWidget* parent) : +ColorEdit::ColorEdit(QWidget* parent) : QWidget{parent}, lineEdit{new QLineEdit{this}}, button{new QPushButton{"…", this}} @@ -38,12 +38,12 @@ this->setColor(Qt::black); } -QColor ColorButton::color() const +QColor ColorEdit::color() const { return QColor{this->lineEdit->text()}; } -void ColorButton::setColor(const QColor& color) +void ColorEdit::setColor(const QColor& color) { if (color.isValid() and this->color() != color) { this->lineEdit->setText(color.name()); diff -r 3e3784c4cd3e -r 5c655cc006de widgets/colorbutton.h --- a/widgets/colorbutton.h Sat Apr 08 15:08:19 2023 +0300 +++ b/widgets/colorbutton.h Sat Apr 08 15:11:39 2023 +0300 @@ -5,15 +5,15 @@ /** * @brief A button that can be used to select a color */ -class ColorButton : public QWidget +class ColorEdit : public QWidget { Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) QLineEdit* lineEdit; QPushButton* button; public: - ColorButton(const QColor& color = {}, QWidget* parent = nullptr); - ColorButton(QWidget* parent = nullptr); + ColorEdit(const QColor& color = {}, QWidget* parent = nullptr); + ColorEdit(QWidget* parent = nullptr); QColor color() const; Q_SLOT void setColor(const QColor& color); Q_SIGNAL void colorChanged(const QColor& color); diff -r 3e3784c4cd3e -r 5c655cc006de widgets/designerplugins.cpp --- a/widgets/designerplugins.cpp Sat Apr 08 15:08:19 2023 +0300 +++ b/widgets/designerplugins.cpp Sat Apr 08 15:11:39 2023 +0300 @@ -134,5 +134,5 @@ QWidget* ColorButtonPlugin::createWidget(QWidget* parent) { - return new ColorButton{parent}; + return new ColorEdit{parent}; }