17 */ |
17 */ |
18 |
18 |
19 #pragma once |
19 #pragma once |
20 #include <QDialog> |
20 #include <QDialog> |
21 #include "main.h" |
21 #include "main.h" |
|
22 #include "colors.h" |
22 |
23 |
23 class LDColor; |
|
24 class Ui_ColorSelUI; |
24 class Ui_ColorSelUI; |
25 class QGraphicsScene; |
25 class QGraphicsScene; |
26 |
26 |
27 class ColorSelector : public QDialog |
27 class ColorSelector : public QDialog |
28 { |
28 { |
29 Q_OBJECT |
29 Q_OBJECT |
30 PROPERTY (private, LDColor*, selection, setSelection, STOCK_WRITE) |
30 PROPERTY (private, LDColor, selection, setSelection, STOCK_WRITE) |
31 |
31 |
32 public: |
32 public: |
33 explicit ColorSelector (int defval = -1, QWidget* parent = null); |
33 explicit ColorSelector (LDColor defval = null, QWidget* parent = null); |
34 virtual ~ColorSelector(); |
34 virtual ~ColorSelector(); |
35 static bool selectColor (int& val, int defval = -1, QWidget* parent = null); |
35 static bool selectColor (LDColor& val, LDColor defval = null, QWidget* parent = null); |
36 |
36 |
37 protected: |
37 protected: |
38 void mousePressEvent (QMouseEvent* event); |
38 void mousePressEvent (QMouseEvent* event); |
39 void resizeEvent (QResizeEvent* ev); |
39 void resizeEvent (QResizeEvent* ev); |
40 |
40 |
41 private: |
41 private: |
42 Ui_ColorSelUI* ui; |
42 Ui_ColorSelUI* ui; |
43 QGraphicsScene* m_scene; |
43 QGraphicsScene* m_scene; |
44 bool m_firstResize; |
44 bool m_firstResize; |
45 |
45 |
46 int numRows() const; |
46 int numRows() const; |
47 int viewportWidth() const; |
47 int viewportWidth() const; |
48 void drawScene(); |
48 void drawScene(); |
49 void drawColorInfo(); |
49 void drawColorInfo(); |
|
50 void selectDirectColor (QColor col); |
|
51 |
|
52 private slots: |
|
53 void chooseDirectColor(); |
|
54 void transparentCheckboxClicked(); |
50 }; |
55 }; |