src/widgets/matrixeditor.h

changeset 1391
5fa4bf1fc781
child 1403
7a2d84112983
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/widgets/matrixeditor.h	Mon Jun 04 23:12:40 2018 +0300
@@ -0,0 +1,37 @@
+#pragma once
+#include <QWidget>
+#include "../linetypes/modelobject.h"
+
+class QDoubleSpinBox;
+class Ui_MatrixEditor;
+
+class MatrixEditor : public QWidget
+{
+	Q_OBJECT
+
+public:
+	MatrixEditor(
+		const Matrix& matrix = Matrix::identity,
+		const Vertex& position = {0, 0, 0},
+		QWidget* parent = nullptr
+	);
+	MatrixEditor(QWidget* parent);
+	~MatrixEditor();
+
+	Vertex position() const;
+	Matrix matrix() const;
+	void setPosition(const Vertex& position);
+	void setMatrix(const Matrix& matrix);
+
+private slots:
+	void scalingChanged();
+	void matrixChanged();
+
+private:
+	QDoubleSpinBox* matrixCell(int row, int column) const;
+	double matrixScaling(int column) const;
+	QPair<int, int> cellPosition(QDoubleSpinBox* cellWidget);
+	QDoubleSpinBox* vectorElement(int index);
+
+	Ui_MatrixEditor& ui;
+};

mercurial