aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvme.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmlvme.cpp')
-rw-r--r--src/qml/qml/qqmlvme.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index 9115e479e1..985d291a8e 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -68,7 +68,6 @@
#include "qqmlvaluetypeproxybinding_p.h"
#include <QStack>
-#include <QColor>
#include <QPointF>
#include <QSizeF>
#include <QRectF>
@@ -273,6 +272,17 @@ static QVariant variantFromString(const QString &string)
QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); \
QML_END_INSTR(name)
+#define QML_STORE_PROVIDER_VALUE(name, type, value) \
+ QML_BEGIN_INSTR(name) \
+ struct { void *data[4]; } buffer; \
+ if (QQml_valueTypeProvider()->storeValueType(type, &value, &buffer, sizeof(buffer))) { \
+ void *a[] = { reinterpret_cast<void *>(&buffer), 0, &status, &flags }; \
+ QObject *target = objects.top(); \
+ CLEAN_PROPERTY(target, instr.propertyIndex); \
+ QMetaObject::metacall(target, QMetaObject::WriteProperty, instr.propertyIndex, a); \
+ } \
+ QML_END_INSTR(name)
+
#define QML_STORE_LIST(name, cpptype, value) \
QML_BEGIN_INSTR(name) \
cpptype v; \
@@ -372,7 +382,7 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_STORE_VALUE(StoreDouble, double, instr.value);
QML_STORE_VALUE(StoreBool, bool, instr.value);
QML_STORE_VALUE(StoreInteger, int, instr.value);
- QML_STORE_VALUE(StoreColor, QColor, QColor::fromRgba(instr.value));
+ QML_STORE_PROVIDER_VALUE(StoreColor, QMetaType::QColor, instr.value);
QML_STORE_VALUE(StoreDate, QDate, QDate::fromJulianDay(instr.value));
QML_STORE_VALUE(StoreDateTime, QDateTime,
QDateTime(QDate::fromJulianDay(instr.date), *(QTime *)&instr.time));
@@ -383,8 +393,8 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_STORE_POINTER(StoreSizeF, (QSizeF *)&instr.size);
QML_STORE_POINTER(StoreRect, (QRect *)&instr.rect);
QML_STORE_POINTER(StoreRectF, (QRectF *)&instr.rect);
- QML_STORE_POINTER(StoreVector3D, (QVector3D *)&instr.vector);
- QML_STORE_POINTER(StoreVector4D, (QVector4D *)&instr.vector);
+ QML_STORE_PROVIDER_VALUE(StoreVector3D, QMetaType::QVector3D, instr.vector);
+ QML_STORE_PROVIDER_VALUE(StoreVector4D, QMetaType::QVector4D, instr.vector);
QML_STORE_POINTER(StoreString, &PRIMITIVES.at(instr.value));
QML_STORE_POINTER(StoreByteArray, &DATAS.at(instr.value));
QML_STORE_POINTER(StoreUrl, &URLS.at(instr.value));
@@ -696,11 +706,14 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
if (prop.type() & QQmlProperty::SignalProperty) {
QMetaMethod method = QQmlMetaType::defaultMethod(assign);
- if (method.signature() == 0)
+ if (!method.isValid())
VME_EXCEPTION(tr("Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())), instr.line);
- if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature()))
- VME_EXCEPTION(tr("Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature())), instr.line);
+ if (!QMetaObject::checkConnectArgs(prop.method(), method)) {
+ VME_EXCEPTION(tr("Cannot connect mismatched signal/slot %1 %vs. %2")
+ .arg(QString::fromLatin1(method.methodSignature().constData()))
+ .arg(QString::fromLatin1(prop.method().methodSignature().constData())), instr.line);
+ }
QQmlPropertyPrivate::connect(target, prop.index(), assign, method.methodIndex());