summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-06-18 09:46:35 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-07 11:15:55 +0200
commit9a0b7348b3548c5062db28129b11a8f1abbd7540 (patch)
treeea40bf31f4f038144a930be9c426cf9cb5656739 /src
parent39c2fdd9070f81705f1de927694b8589f69da149 (diff)
Make QSignalSpy copy QVariant parameters directly
Previously, a QVariant parameter would be wrapped inside a new QVariant, and you would have to cast the QSignalSpy's QVariant to a QVariant to get the actual value. This behavior was unintuitive and undocumented. Check if the parameter type is QVariant, and copy it directly if it is. This makes the QSignalSpy's QVariant directly usable (no need to "unwrap" the value in user code). Existing tests that use QSignalSpy together with QVariant parameters (such as tst_QPropertyAnimation::valueChanged()) and do cast the QVariant parameter to a QVariant, continue to work after this change; this is because qvariant_cast<QVariant>() returns its input value (unchanged) when the type is not QMetaType::QVariant. Task-number: QTBUG-21645 Change-Id: Ibfb171edd60c0d3f7ca1d5419e5c5f3d0380d5b3 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/testlib/qsignalspy.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/testlib/qsignalspy.h b/src/testlib/qsignalspy.h
index 18def8f6c4..0740ba5622 100644
--- a/src/testlib/qsignalspy.h
+++ b/src/testlib/qsignalspy.h
@@ -147,7 +147,10 @@ private:
QList<QVariant> list;
for (int i = 0; i < args.count(); ++i) {
QMetaType::Type type = static_cast<QMetaType::Type>(args.at(i));
- list << QVariant(type, a[i + 1]);
+ if (type == QMetaType::QVariant)
+ list << *reinterpret_cast<QVariant *>(a[i + 1]);
+ else
+ list << QVariant(type, a[i + 1]);
}
append(list);