#ifndef MATRIXEDIT_H
#define MATRIXEDIT_H

#include <QWidget>
#include "qad_export.h"


namespace Ui {
	class MatrixEdit;
}


class QAD_EXPORT MatrixEdit: public QWidget {
	Q_OBJECT
public:
	explicit MatrixEdit(QWidget * parent = 0);
	~MatrixEdit();

	bool isReadOnly() const;
	void setReadOnly(bool yes);

	QVector<double> vector() const;
	QVector<QVector<double> > matrix() const;
	void setVector(const QVector<double> & v);
	void setMatrix(const QVector<QVector<double> > & v);

private:
	void setVectorMode(bool yes);
	void clear(bool ident = false);

	Ui::MatrixEdit * ui;
	bool ro;

private slots:
	void on_spinRows_valueChanged(int cnt);
	void on_spinCols_valueChanged(int cnt);
	void on_buttonNull_clicked();
	void on_buttonIdentity_clicked();

signals:
	void changed();
	
};


#endif // MATRIXEDIT_H
