diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-03-02 08:25:43 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-20 03:15:43 +0100 |
commit | ab1e510121c8a679fdaca12ccd30e0f7ac12a26b (patch) | |
tree | 68c377ba468a667c43211f005ead5b49b16e49f3 /src/qml/qml/qqmlvme.cpp | |
parent | b143d3fb589e7ce7171c9975679fa47181a6a10f (diff) |
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 <martin.jones@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlvme.cpp')
-rw-r--r-- | src/qml/qml/qqmlvme.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
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 <QStack> -#include <QColor> #include <QPointF> #include <QSizeF> #include <QRectF> @@ -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<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; \ @@ -366,7 +376,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)); @@ -377,8 +387,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)); |