widgets/colorbutton.h

Sun, 26 Jun 2022 20:54:09 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sun, 26 Jun 2022 20:54:09 +0300
changeset 262
dc33f8a707c4
parent 257
afdab56e8210
child 344
a24da8de2a3b
permissions
-rw-r--r--

Add action to make a model unofficial (modifies the !LDRAW_ORG line)

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