Inline editing of QDecDouble in AutoTableModel now possible.
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
#include <QMetaProperty>
|
#include <QMetaProperty>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QDecDouble.hh>
|
||||||
|
|
||||||
#include "../qdecimal/src/QDecDouble.hh"
|
#include "../qdecimal/src/QDecDouble.hh"
|
||||||
|
|
||||||
@@ -264,7 +265,14 @@ public:
|
|||||||
QSharedPointer<T> entity = m_list.at(index.row());
|
QSharedPointer<T> entity = m_list.at(index.row());
|
||||||
QObject *rawEntity = (QObject*)entity.data();
|
QObject *rawEntity = (QObject*)entity.data();
|
||||||
|
|
||||||
rawEntity->setProperty(rawEntity->metaObject()->property(index.column() + 1).name(), value);
|
QVariant val = value;
|
||||||
|
if (rawEntity->property(rawEntity->metaObject()->property(index.column() + 1).name()).canConvert<QDecDouble>())
|
||||||
|
{
|
||||||
|
QDecDouble dec(val.toDouble());
|
||||||
|
val = QVariant::fromValue(dec);
|
||||||
|
}
|
||||||
|
|
||||||
|
rawEntity->setProperty(rawEntity->metaObject()->property(index.column() + 1).name(), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role == Qt::CheckStateRole)
|
if (role == Qt::CheckStateRole)
|
||||||
|
|||||||
Reference in New Issue
Block a user