src/widgets/colorbutton.cpp

changeset 256
c6f5de03dc0f
parent 255
5188f8a74a5c
child 257
afdab56e8210
--- a/src/widgets/colorbutton.cpp	Wed Jun 22 22:50:37 2022 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#include <QColorDialog>
-#include "colorbutton.h"
-
-ColorButton::ColorButton(const QColor& color, QWidget* parent) :
-	ColorButton{parent}
-{
-	this->setSelectedColor(color);
-}
-
-ColorButton::ColorButton(QWidget* parent) :
-	QPushButton{parent}
-{
-	connect(this, &QPushButton::clicked, [&]()
-	{
-		const QColor color = QColorDialog::getColor(this->storedSelectedColor, this->parentWidget());
-		if (color.isValid())
-		{
-			this->setSelectedColor(color);
-		}
-	});
-}
-
-QColor ColorButton::selectedColor() const
-{
-	return this->storedSelectedColor;
-}
-
-void ColorButton::setSelectedColor(const QColor& newSelectedColor)
-{
-	this->storedSelectedColor = newSelectedColor;
-	this->setStyleSheet(QString{"background-color: %1"}.arg(newSelectedColor.name()));
-	this->setText(newSelectedColor.name());
-}
-

mercurial