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

#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