From ab1e510121c8a679fdaca12ccd30e0f7ac12a26b Mon Sep 17 00:00:00 2001 From: Matthew Vogt Date: Fri, 2 Mar 2012 08:25:43 +1000 Subject: Migrate gui dependencies from QtQml to QtQuick. Ensure that users of declarative that have no need for functionality provided by the Qt Gui module do not have to link against it. Any use of QtGui functionality is delegated to providers that can be installed by another library; QtQuick adds default providers for this functionality when linked against QtQml. Task-number: QTBUG-24559 Change-Id: I5e6a58a4198732dc2f8f52f71abfa1152b871aa7 Reviewed-by: Martin Jones --- src/qml/qml/qqmlvme.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/qml/qml/qqmlvme.cpp') diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index 86e9f0963a..6309335e59 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -68,7 +68,6 @@ #include "qqmlvaluetypeproxybinding_p.h" #include -#include #include #include #include @@ -267,6 +266,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(&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; \ @@ -366,7 +376,7 @@ QObject *QQmlVME::run(QList *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)); @@ -377,8 +387,8 @@ QObject *QQmlVME::run(QList *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)); -- cgit v1.2.3