src/ui/objecteditor.h

Wed, 25 May 2022 20:36:34 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 25 May 2022 20:36:34 +0300
changeset 199
6988973515d2
parent 183
97b591813c8b
child 200
ca23936b455b
permissions
-rw-r--r--

Fix pick() picking from weird places on the screen with high DPI scaling

glReadPixels reads data from the frame buffer, which contains data after
high DPI scaling, so any reads to that need to take this scaling into account

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
03f8e6d42e13 Major refactoring
Teemu Piippo <teemu@hecknology.net>
parents: 81
diff changeset
6 class Document;
03f8e6d42e13 Major refactoring
Teemu Piippo <teemu@hecknology.net>
parents: 81
diff changeset
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
03f8e6d42e13 Major refactoring
Teemu Piippo <teemu@hecknology.net>
parents: 81
diff changeset
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
03f8e6d42e13 Major refactoring
Teemu Piippo <teemu@hecknology.net>
parents: 81
diff changeset
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
a23024fc98e0 fix saving
Teemu Piippo <teemu@hecknology.net>
parents: 177
diff changeset
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 };

mercurial