Mon, 27 Jun 2022 01:57:06 +0300
Further use APPNAME macro
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 | }; |