moved to shstk
This commit is contained in:
53
libs/widgets/mathmatrixedit.cpp
Normal file
53
libs/widgets/mathmatrixedit.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#include "mathmatrixedit.h"
|
||||
#include "qvariantedit_custom.h"
|
||||
#include "matrixedit.h"
|
||||
#include <QBoxLayout>
|
||||
|
||||
|
||||
MathMatrixEdit::MathMatrixEdit(QWidget * parent): QWidget(parent) {
|
||||
edit = new MatrixEdit();
|
||||
setLayout(new QBoxLayout(QBoxLayout::LeftToRight));
|
||||
layout()->setContentsMargins(0, 0, 0, 0);
|
||||
layout()->addWidget(edit);
|
||||
connect(edit, SIGNAL(changed()), this, SIGNAL(valueChanged()));
|
||||
}
|
||||
|
||||
|
||||
MathMatrixEdit::~MathMatrixEdit() {
|
||||
delete edit;
|
||||
}
|
||||
|
||||
|
||||
QVariant MathMatrixEdit::value() const {
|
||||
return QVariant::fromValue(QAD::MathMatrix(edit->matrix()));
|
||||
}
|
||||
|
||||
|
||||
bool MathMatrixEdit::isReadOnly() const {
|
||||
return edit->isReadOnly();
|
||||
}
|
||||
|
||||
|
||||
void MathMatrixEdit::setValue(const QVariant & v) {
|
||||
edit->setMatrix(v.value<QAD::MathMatrix>().m);
|
||||
}
|
||||
|
||||
|
||||
void MathMatrixEdit::setReadOnly(bool yes) {
|
||||
edit->setReadOnly(yes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class MathMatrixEditFactory: public QVariantEditorFactoryBase {
|
||||
public:
|
||||
MathMatrixEditFactory() {}
|
||||
virtual QWidget * createEditor() {return new MathMatrixEdit();}
|
||||
};
|
||||
|
||||
|
||||
__MathMatrixEditRegistrator__::__MathMatrixEditRegistrator__() {
|
||||
QVariantEditorFactories::registerEditorFactory(qMetaTypeId<QAD::MathMatrix>(), new MathMatrixEditFactory());
|
||||
//__QADTypesRegistrator__::instance()->toString_funcs.insert(qMetaTypeId<QAD::IODevice>(), &QAD_IODevice_toString);
|
||||
}
|
||||
Reference in New Issue
Block a user