widgets/vec3editor.h

Sat, 08 Apr 2023 12:55:11 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sat, 08 Apr 2023 12:55:11 +0300
changeset 343
4a82990affd5
parent 264
76a025db4948
permissions
-rw-r--r--

Fix BFC formatting not working due to being evaluated after comment format

81
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #pragma once
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include <QWidget>
252
da4876bfd822 Move some widgets into a static library
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 206
diff changeset
3 #include <glm/glm.hpp>
264
76a025db4948 Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 255
diff changeset
4 #include <ui_vec3editor.h>
81
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5
254
b7b29cb82360 Rename Vec3Editor to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 252
diff changeset
6 class VectorInput : public QWidget
81
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 {
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 Q_OBJECT
255
5188f8a74a5c Add x, y, z properties to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
9 Q_PROPERTY(qreal x READ x WRITE setX)
5188f8a74a5c Add x, y, z properties to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
10 Q_PROPERTY(qreal y READ y WRITE setY)
5188f8a74a5c Add x, y, z properties to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
11 Q_PROPERTY(qreal z READ z WRITE setZ)
254
b7b29cb82360 Rename Vec3Editor to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 252
diff changeset
12 Ui_Vec3Editor ui;
81
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 public:
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 enum Flag
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 {
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 NoMultiplyButton = 0x1
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 };
254
b7b29cb82360 Rename Vec3Editor to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 252
diff changeset
18 explicit VectorInput(const glm::vec3& value, QWidget* parent = nullptr, QFlags<Flag> flags = {});
b7b29cb82360 Rename Vec3Editor to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 252
diff changeset
19 explicit VectorInput(QWidget* parent = nullptr, QFlags<Flag> flags = {});
b7b29cb82360 Rename Vec3Editor to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 252
diff changeset
20 ~VectorInput();
81
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 glm::vec3 value() const;
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 void setValue(const glm::vec3& value);
255
5188f8a74a5c Add x, y, z properties to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
23 qreal x() const;
5188f8a74a5c Add x, y, z properties to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
24 qreal y() const;
5188f8a74a5c Add x, y, z properties to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
25 qreal z() const;
5188f8a74a5c Add x, y, z properties to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
26 Q_SLOT void setX(qreal x);
5188f8a74a5c Add x, y, z properties to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
27 Q_SLOT void setY(qreal y);
5188f8a74a5c Add x, y, z properties to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
28 Q_SLOT void setZ(qreal z);
5188f8a74a5c Add x, y, z properties to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
29 Q_SIGNAL void valueChanged(const glm::vec3& value);
81
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 private:
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 std::array<class DoubleSpinBox*, 3> spinboxes();
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32 Q_SLOT void multiplyPressed();
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 };
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34
254
b7b29cb82360 Rename Vec3Editor to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 252
diff changeset
35 Q_DECLARE_OPERATORS_FOR_FLAGS(QFlags<VectorInput::Flag>)

mercurial