src/ui/objecteditor.h

Wed, 25 May 2022 17:47:06 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 25 May 2022 17:47:06 +0300
changeset 194
be056e87c8ca
parent 183
97b591813c8b
child 200
ca23936b455b
permissions
-rw-r--r--

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);
};

mercurial