Wed, 25 May 2022 17:47:06 +0300
simplify further
#pragma once #include <QWidget> #include "../main.h" #include "../model.h" class Document; class ObjectEditor : public QWidget { Q_OBJECT public: explicit ObjectEditor(Document* document, ldraw::id_t id = ldraw::NULL_ID); ~ObjectEditor(); void setObjectId(ldraw::id_t id); private: Q_SLOT void handleColorChange(ldraw::Color value); Q_SLOT void handleVec3Change(const glm::vec3& value); Q_SLOT void handleBoolChange(bool value); Q_SLOT void handleStringChange(const QString& value); class Ui_ObjectEditor& ui; Document* const document; ldraw::id_t objectId = ldraw::NULL_ID; QMap<ldraw::Property, QPair<QWidget*, QWidget*>> propertyWidgets; QWidget* makeEditorWidgetForProperty(ldraw::Property property); void handlePropertyChange(QObject* caller, const QVariant& value); };