widgets/coloredit.h

Mon, 10 Apr 2023 12:40:49 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Mon, 10 Apr 2023 12:40:49 +0300
changeset 369
57de8fab2237
parent 348
98776f54a8d0
permissions
-rw-r--r--

isConvex renamed to quadrilateral_convexity, refactor, now returns an enum instead of bool

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>
344
a24da8de2a3b Changed color button to a line edit+button combination
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 257
diff changeset
3 #include <QLineEdit>
39
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 /**
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 * @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
7 */
347
5c655cc006de Rename ColorButton -> ColorEdit
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 344
diff changeset
8 class ColorEdit : public QWidget
39
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 {
256
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 39
diff changeset
10 Q_OBJECT
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 39
diff changeset
11 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
344
a24da8de2a3b Changed color button to a line edit+button combination
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 257
diff changeset
12 QLineEdit* lineEdit;
a24da8de2a3b Changed color button to a line edit+button combination
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 257
diff changeset
13 QPushButton* button;
39
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 public:
347
5c655cc006de Rename ColorButton -> ColorEdit
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 344
diff changeset
15 ColorEdit(const QColor& color = {}, QWidget* parent = nullptr);
5c655cc006de Rename ColorButton -> ColorEdit
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 344
diff changeset
16 ColorEdit(QWidget* parent = nullptr);
344
a24da8de2a3b Changed color button to a line edit+button combination
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 257
diff changeset
17 QColor color() const;
256
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 39
diff changeset
18 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
19 Q_SIGNAL void colorChanged(const QColor& color);
39
caac957e9834 Main color is now configurable
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 };

mercurial