widgets/vec3editor.h

Fri, 01 Jul 2022 16:46:43 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Fri, 01 Jul 2022 16:46:43 +0300
changeset 312
2637134bc37c
parent 264
76a025db4948
permissions
-rw-r--r--

Fix right click to delete not really working properly
Instead of removing the point that had been added, it would remove
the point that is being drawn, which would cause it to overwrite the
previous point using the new point, causing a bit of a delay

#pragma once
#include <QWidget>
#include <glm/glm.hpp>
#include <ui_vec3editor.h>

class VectorInput : public QWidget
{
	Q_OBJECT
	Q_PROPERTY(qreal x READ x WRITE setX)
	Q_PROPERTY(qreal y READ y WRITE setY)
	Q_PROPERTY(qreal z READ z WRITE setZ)
	Ui_Vec3Editor ui;
public:
	enum Flag
	{
		NoMultiplyButton = 0x1
	};
	explicit VectorInput(const glm::vec3& value, QWidget* parent = nullptr, QFlags<Flag> flags = {});
	explicit VectorInput(QWidget* parent = nullptr, QFlags<Flag> flags = {});
	~VectorInput();
	glm::vec3 value() const;
	void setValue(const glm::vec3& value);
	qreal x() const;
	qreal y() const;
	qreal z() const;
	Q_SLOT void setX(qreal x);
	Q_SLOT void setY(qreal y);
	Q_SLOT void setZ(qreal z);
	Q_SIGNAL void valueChanged(const glm::vec3& value);
private:
	std::array<class DoubleSpinBox*, 3> spinboxes();
	Q_SLOT void multiplyPressed();
};

Q_DECLARE_OPERATORS_FOR_FLAGS(QFlags<VectorInput::Flag>)

mercurial