Fri, 01 Jul 2022 16:46:43 +0300
Fix right click to delete not really working properly
Instead of removing the point that had been added, it would remove
the point that is being drawn, which would cause it to overwrite the
previous point using the new point, causing a bit of a delay
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 | }; |