diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-09-23 12:28:41 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2014-09-23 13:07:11 +0200 |
commit | f3edb627dc0cf780a593765babde59e1194aa9eb (patch) | |
tree | 0ca76620202214c6dd8577175f7761e89942adde /src/imports | |
parent | 3a4fb52902f711de9662078aa22f2e92a8d17604 (diff) | |
download | qtlocation-f3edb627dc0cf780a593765babde59e1194aa9eb.tar.gz |
Fix DeclarativePlace unit test
This broke due to a behavior change in QtDeclarative when converting
JS Array to C++. For more details see QTBUG-40431.
Change-Id: Id666b4872a5cd1e435cca67b5362c2ab3beb3633
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/location/declarativeplaces/qdeclarativeplace.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp index 0b755b19..05fa3d01 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp @@ -1203,14 +1203,18 @@ QPlaceManager *QDeclarativePlace::manager() */ QString QDeclarativePlace::primaryValue(const QString &contactType) const { - if (m_contactDetails->value(contactType).userType() == QVariant::List) { + QVariant value = m_contactDetails->value(contactType); + if (value.userType() == qMetaTypeId<QJSValue>()) + value = value.value<QJSValue>().toVariant(); + + if (value.userType() == QVariant::List) { QVariantList detailList = m_contactDetails->value(contactType).toList(); if (!detailList.isEmpty()) { QDeclarativeContactDetail *primaryDetail = qobject_cast<QDeclarativeContactDetail *>(detailList.at(0).value<QObject *>()); if (primaryDetail) return primaryDetail->value(); } - } else if (m_contactDetails->value(contactType).userType() == QMetaType::QObjectStar) { + } else if (value.userType() == QMetaType::QObjectStar) { QDeclarativeContactDetail *primaryDetail = qobject_cast<QDeclarativeContactDetail *>(m_contactDetails->value(contactType).value<QObject *>()); if (primaryDetail) return primaryDetail->value(); |