git-svn-id: svn://db.shs.com.ru/libs@586 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
53
test/qad/widgets/mathvectoredit.cpp
Normal file
53
test/qad/widgets/mathvectoredit.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#include "mathvectoredit.h"
|
||||
#include "qvariantedit_custom.h"
|
||||
#include "matrixedit.h"
|
||||
#include <QBoxLayout>
|
||||
|
||||
|
||||
MathVectorEdit::MathVectorEdit(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()));
|
||||
}
|
||||
|
||||
|
||||
MathVectorEdit::~MathVectorEdit() {
|
||||
delete edit;
|
||||
}
|
||||
|
||||
|
||||
QVariant MathVectorEdit::value() const {
|
||||
return QVariant::fromValue(QAD::MathVector(edit->vector()));
|
||||
}
|
||||
|
||||
|
||||
bool MathVectorEdit::isReadOnly() const {
|
||||
return edit->isReadOnly();
|
||||
}
|
||||
|
||||
|
||||
void MathVectorEdit::setValue(const QVariant & v) {
|
||||
edit->setVector(v.value<QAD::MathVector>().v);
|
||||
}
|
||||
|
||||
|
||||
void MathVectorEdit::setReadOnly(bool yes) {
|
||||
edit->setReadOnly(yes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class MathVectorEditFactory: public QVariantEditorFactoryBase {
|
||||
public:
|
||||
MathVectorEditFactory() {}
|
||||
virtual QWidget * createEditor() {return new MathVectorEdit();}
|
||||
};
|
||||
|
||||
|
||||
__MathVectorEditRegistrator__::__MathVectorEditRegistrator__() {
|
||||
QVariantEditorFactories::registerEditorFactory(qMetaTypeId<QAD::MathVector>(), new MathVectorEditFactory());
|
||||
//__QADTypesRegistrator__::instance()->toString_funcs.insert(qMetaTypeId<QAD::IODevice>(), &QAD_IODevice_toString);
|
||||
}
|
||||
Reference in New Issue
Block a user