Rename ColorButton -> ColorEdit

Sat, 08 Apr 2023 15:11:39 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sat, 08 Apr 2023 15:11:39 +0300
changeset 347
5c655cc006de
parent 346
3e3784c4cd3e
child 348
98776f54a8d0

Rename ColorButton -> ColorEdit

src/settingseditor/settingseditor.cpp file | annotate | diff | comparison | revisions
src/settingseditor/settingseditor.ui file | annotate | diff | comparison | revisions
widgets/colorbutton.cpp file | annotate | diff | comparison | revisions
widgets/colorbutton.h file | annotate | diff | comparison | revisions
widgets/designerplugins.cpp file | annotate | diff | comparison | revisions
--- 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<QSpinBox*>()) {
 		connect(widget, qOverload<int>(&QSpinBox::valueChanged), this, &SettingsEditor::saveSettings);
 	}
-	for (auto* widget : this->findChildren<ColorButton*>()) {
-		connect(widget, &ColorButton::colorChanged, this, &SettingsEditor::saveSettings);
+	for (auto* widget : this->findChildren<ColorEdit*>()) {
+		connect(widget, &ColorEdit::colorChanged, this, &SettingsEditor::saveSettings);
 	}
 	for (auto* widget : this->findChildren<QComboBox*>()) {
 		connect(widget, qOverload<int>(&QComboBox::currentIndexChanged), this, &SettingsEditor::saveSettings);
--- 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 @@
                  </widget>
                 </item>
                 <item row="0" column="1">
-                 <widget class="ColorButton" name="mainColorButton"/>
+                 <widget class="ColorEdit" name="mainColorButton"/>
                 </item>
                 <item row="1" column="0">
                  <widget class="QLabel" name="label_5">
@@ -127,7 +127,7 @@
                  </widget>
                 </item>
                 <item row="1" column="1">
-                 <widget class="ColorButton" name="selectedColorButton"/>
+                 <widget class="ColorEdit" name="selectedColorButton"/>
                 </item>
                 <item row="2" column="0">
                  <widget class="QLabel" name="label_3">
@@ -137,7 +137,7 @@
                  </widget>
                 </item>
                 <item row="2" column="1">
-                 <widget class="ColorButton" name="backgroundColorButton"/>
+                 <widget class="ColorEdit" name="backgroundColorButton"/>
                 </item>
                 <item row="3" column="0">
                  <widget class="QLabel" name="label_4">
@@ -251,7 +251,7 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>ColorButton</class>
+   <class>ColorEdit</class>
    <extends>QPushButton</extends>
    <header>widgets/colorbutton.h</header>
   </customwidget>
--- 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 <QHBoxLayout>
 #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());
--- 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);
--- 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};
 }

mercurial