forked from andreagen0r/ColorPicker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolortool_p.h
47 lines (34 loc) · 1.29 KB
/
colortool_p.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include <QObject>
#include <QQmlEngine>
#include <QColor>
class ColorTool_p : public QObject {
Q_OBJECT
QML_ELEMENT
Q_PROPERTY( QColor primary READ primary WRITE setPrimary NOTIFY primaryChanged FINAL )
Q_PROPERTY( QColor secondary READ secondary WRITE setSecondary NOTIFY secondaryChanged FINAL )
Q_PROPERTY( QColor currentColor READ currentColor WRITE setCurrentColor NOTIFY currentColorChanged FINAL )
Q_PROPERTY( bool swapSwatch READ swapSwatch NOTIFY swapSwatchChanged FINAL )
public:
explicit ColorTool_p( QObject* parent = nullptr );
[[nodiscard]] const QColor& primary() const;
Q_INVOKABLE void setPrimary( const QColor& newPrimary );
[[nodiscard]] const QColor& secondary() const;
Q_INVOKABLE void setSecondary( const QColor& newSecondary );
Q_INVOKABLE void swap();
[[nodiscard]] const QColor& currentColor() const;
Q_INVOKABLE void setCurrentColor( const QColor& newCurrentColor );
[[nodiscard]] bool swapSwatch() const;
Q_INVOKABLE void swapSwatchPlane();
Q_INVOKABLE void reset();
Q_SIGNALS:
void primaryChanged();
void secondaryChanged();
void currentColorChanged();
void swapSwatchChanged();
private:
QColor m_primary;
QColor m_secondary;
QColor m_currentColor;
bool m_swapSwatch;
};