widgets/colorbutton.h

Sat, 08 Apr 2023 12:55:11 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sat, 08 Apr 2023 12:55:11 +0300
changeset 343
4a82990affd5
parent 257
afdab56e8210
child 344
a24da8de2a3b
permissions
-rw-r--r--

Fix BFC formatting not working due to being evaluated after comment format

39
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #pragma once
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include <QPushButton>
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 /**
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 * @brief A button that can be used to select a color
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 */
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 class ColorButton : public QPushButton
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 {
256
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 39
diff changeset
9 Q_OBJECT
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 39
diff changeset
10 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
257
afdab56e8210 Fix appearance of ColorButton
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 256
diff changeset
11 QColor storedSelectedColor;
39
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 public:
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 ColorButton(const QColor& color = {}, QWidget* parent = nullptr);
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 ColorButton(QWidget* parent = nullptr);
256
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 39
diff changeset
15 const QColor& color() const;
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 39
diff changeset
16 Q_SLOT void setColor(const QColor& color);
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 39
diff changeset
17 Q_SIGNAL void colorChanged(const QColor& color);
39
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18 };

mercurial