summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-01-16 11:15:40 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-24 14:01:56 +0100
commit091496f0c1a44991ebad534edc7ba0f2332ae02c (patch)
tree3cca7557032b803eec333032ede2fe9d6cd561bd /src
parenta5928f1d781f723dff03a839fe2228dc47d8c9b5 (diff)
Support QMetaType::QVariant as the type for QVariant properties
Change http://codereview.qt-project.org/#change,12408 in qtbase updates moc and friends to use QMetaType::QVariant instead of the magic -1 / 0xffffffff / QVariant::LastType. This change adapts activeqt accordingly. Once the qtbase change has been merged, the LastType checks in activeqt can be removed. Change-Id: I70eb0eca00d63bcf3145a83b76c09399e5178c7b Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/activeqt/container/qaxbase.cpp4
-rw-r--r--src/activeqt/shared/qaxtypes.cpp8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp
index 814879b..c08d164 100644
--- a/src/activeqt/container/qaxbase.cpp
+++ b/src/activeqt/container/qaxbase.cpp
@@ -503,7 +503,7 @@ public:
const QMetaProperty metaProp = meta->property(meta->indexOfProperty(propname));
void *argv[] = {0, var.data()};
- if (metaProp.type() == QVariant::LastType)
+ if (metaProp.type() == QVariant::Type(QMetaType::QVariant) || metaProp.type() == QVariant::LastType)
argv[1] = &var;
// emit the "changed" signal
@@ -3534,7 +3534,7 @@ int QAxBase::internalProperty(QMetaObject::Call call, int index, void **v)
qvar = *(int*)v[0];
proptype = 0;
} else {
- if (t == QVariant::LastType) {
+ if (t == QVariant::Type(QMetaType::QVariant) || t == QVariant::LastType) {
qvar = *(QVariant*)v[0];
proptype = 0;
} else if (t == QVariant::UserType) {
diff --git a/src/activeqt/shared/qaxtypes.cpp b/src/activeqt/shared/qaxtypes.cpp
index 0cc69af..3c37bf0 100644
--- a/src/activeqt/shared/qaxtypes.cpp
+++ b/src/activeqt/shared/qaxtypes.cpp
@@ -511,7 +511,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type
const QList<QVariant> list = qvar.toList();
const int count = list.count();
VARTYPE vt = VT_VARIANT;
- QVariant::Type listType = QVariant::LastType; // == QVariant
+ QVariant::Type listType = QVariant::Type(QMetaType::QVariant);
if (!typeName.isEmpty() && typeName.startsWith("QList<")) {
const QByteArray listTypeName = typeName.mid(6, typeName.length() - 7); // QList<int> -> int
listType = QVariant::nameToType(listTypeName);
@@ -582,7 +582,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type
array = SafeArrayCreateVector(vt, 0, count);
for (LONG index = 0; index < count; ++index) {
QVariant elem = list.at(index);
- if (listType != QVariant::LastType)
+ if (listType != QVariant::Type(QMetaType::QVariant))
elem.convert(listType);
VariantInit(&variant);
QVariantToVARIANT(elem, variant, elem.typeName());
@@ -820,7 +820,7 @@ bool QVariantToVoidStar(const QVariant &var, void *data, const QByteArray &typeN
if (!data)
return true;
- if (type == QVariant::LastType || (type == 0 && typeName == "QVariant")) {
+ if (type == QMetaType::QVariant || type == QVariant::LastType || (type == 0 && typeName == "QVariant")) {
*(QVariant*)data = var;
return true;
}
@@ -1384,7 +1384,7 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint
if (typeName != "QVariant")
proptype = QVariant::nameToType(typeName);
}
- if (proptype != QVariant::LastType && proptype != QVariant::Invalid && var.type() != proptype) {
+ if (proptype != QVariant::Type(QMetaType::QVariant) && proptype != QVariant::LastType && proptype != QVariant::Invalid && var.type() != proptype) {
if (var.canConvert(proptype)) {
QVariant oldvar = var;
if (oldvar.convert(proptype))