aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvaluetype.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2014-11-19 18:12:21 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-12-28 18:39:51 +0100
commitb7bcde88a35c0dba8bf78b829b60a634137fc778 (patch)
tree34395bdc64775394b8406511c86924c05a9ce73c /src/qml/qml/qqmlvaluetype.cpp
parent7dd5895854087c006d9ec58ada6899df6020b3c6 (diff)
Removed usage of QQmlValueType in QQmlValueTypeWrapper
QQmlValueType doesn't have anything really necessary :). Some code it has, but that was only called from the wrapper, so it was moved there. This also reduces one level of memory allocation for the wrapper. In theory the allocation for the JavaScript wrapper could be changed to be the size of the wrapper _plus_ the size needed for the gadget. However in anticipation of wanting to be able to move objects, we can't do that as we can't memmove() gadgets around - they might contain pointers to memory areas within. Change-Id: Icb5a6f5513e3b2c87f6639f6f7b1fb572af08137 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlvaluetype.cpp')
-rw-r--r--src/qml/qml/qqmlvaluetype.cpp47
1 files changed, 5 insertions, 42 deletions
diff --git a/src/qml/qml/qqmlvaluetype.cpp b/src/qml/qml/qqmlvaluetype.cpp
index 20f3027e4c..e22e0f8fdc 100644
--- a/src/qml/qml/qqmlvaluetype.cpp
+++ b/src/qml/qml/qqmlvaluetype.cpp
@@ -192,24 +192,16 @@ QQmlValueType::~QQmlValueType()
void QQmlValueType::read(QObject *obj, int idx)
{
- readProperty(obj, idx, gadgetPtr);
-}
-
-void QQmlValueType::readVariantValue(QObject *obj, int idx, QVariant *into)
-{
- // important: must not change the userType of the variant
- readProperty(obj, idx, into);
+ void *a[] = { gadgetPtr, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
}
void QQmlValueType::write(QObject *obj, int idx, QQmlPropertyPrivate::WriteFlags flags)
{
Q_ASSERT(gadgetPtr);
- writeProperty(obj, idx, flags, gadgetPtr);
-}
-
-void QQmlValueType::writeVariantValue(QObject *obj, int idx, QQmlPropertyPrivate::WriteFlags flags, QVariant *from)
-{
- writeProperty(obj, idx, flags, from);
+ int status = -1;
+ void *a[] = { gadgetPtr, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
}
QVariant QQmlValueType::value()
@@ -225,35 +217,6 @@ void QQmlValueType::setValue(const QVariant &value)
QMetaType::construct(typeId, gadgetPtr, value.constData());
}
-bool QQmlValueType::isEqual(const QVariant &other) const
-{
- Q_ASSERT(gadgetPtr);
- return QVariant(typeId, gadgetPtr) == other;
-}
-
-QString QQmlValueType::toString() const
-{
- const QMetaObject *mo = metaObject();
- const int toStringIndex = mo->indexOfMethod("toString()");
- if (toStringIndex != -1) {
- QString result;
- void *args[] = { &result, 0 };
- _metaObject->d.static_metacall(reinterpret_cast<QObject*>(gadgetPtr), QMetaObject::InvokeMetaMethod, toStringIndex, args);
- return result;
- }
- QString result = QString::fromUtf8(QMetaType::typeName(typeId));
- result += QLatin1Char('(');
- const int propCount = mo->propertyCount();
- for (int i = 0; i < propCount; ++i) {
- QVariant value = mo->property(i).read(this);
- result += value.toString();
- if (i < propCount - 1)
- result += QStringLiteral(", ");
- }
- result += QLatin1Char(')');
- return result;
-}
-
QAbstractDynamicMetaObject *QQmlValueType::toDynamicMetaObject(QObject *)
{
return this;