Wed, 25 May 2022 17:24:51 +0300
made editing tools not a polymorphic class tree
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> |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
3 | #include "../main.h" |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
4 | #include "../model.h" |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
5 | |
152 | 6 | class Document; |
7 | ||
81
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
8 | class ObjectEditor : public QWidget |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
9 | { |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
10 | Q_OBJECT |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
11 | public: |
152 | 12 | explicit ObjectEditor(Document* document, ldraw::id_t id = ldraw::NULL_ID); |
182
27fb1c3c9fbb
add ui file to object editor
Teemu Piippo <teemu@hecknology.net>
parents:
181
diff
changeset
|
13 | ~ObjectEditor(); |
81
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
14 | void setObjectId(ldraw::id_t id); |
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
15 | private: |
180
5b7a8f2270ff
Handle properties in a generic manner in the object editor
Teemu Piippo <teemu@hecknology.net>
parents:
178
diff
changeset
|
16 | Q_SLOT void handleColorChange(ldraw::Color value); |
5b7a8f2270ff
Handle properties in a generic manner in the object editor
Teemu Piippo <teemu@hecknology.net>
parents:
178
diff
changeset
|
17 | Q_SLOT void handleVec3Change(const glm::vec3& value); |
183
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
182
diff
changeset
|
18 | Q_SLOT void handleBoolChange(bool value); |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
182
diff
changeset
|
19 | Q_SLOT void handleStringChange(const QString& value); |
182
27fb1c3c9fbb
add ui file to object editor
Teemu Piippo <teemu@hecknology.net>
parents:
181
diff
changeset
|
20 | class Ui_ObjectEditor& ui; |
152 | 21 | Document* const document; |
81
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
22 | ldraw::id_t objectId = ldraw::NULL_ID; |
178 | 23 | QMap<ldraw::Property, QPair<QWidget*, QWidget*>> propertyWidgets; |
180
5b7a8f2270ff
Handle properties in a generic manner in the object editor
Teemu Piippo <teemu@hecknology.net>
parents:
178
diff
changeset
|
24 | QWidget* makeEditorWidgetForProperty(ldraw::Property property); |
5b7a8f2270ff
Handle properties in a generic manner in the object editor
Teemu Piippo <teemu@hecknology.net>
parents:
178
diff
changeset
|
25 | void handlePropertyChange(QObject* caller, const QVariant& value); |
81
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
26 | }; |