Wed, 25 May 2022 20:36:34 +0300
Fix pick() picking from weird places on the screen with high DPI scaling
glReadPixels reads data from the frame buffer, which contains data after
high DPI scaling, so any reads to that need to take this scaling into account
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 | { |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
9 | public: |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
10 | ColorButton(const QColor& color = {}, QWidget* parent = nullptr); |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
11 | ColorButton(QWidget* parent = nullptr); |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
12 | QColor selectedColor() const; |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
13 | void setSelectedColor(const QColor& newSelectedColor); |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
14 | private: |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
15 | QColor storedSelectedColor; |
caac957e9834
Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
16 | }; |