mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Removed warning from fixQVariantFromDbusArgument.
@MS: Please crosscheck. In the past function was only called with QDBusArgument. Now called from CVariant sometimes with standard variant types (QString, int). Expected?
This commit is contained in:
@@ -187,29 +187,30 @@ uint BlackMisc::calculateHash(const QList<int> &values, const char *className)
|
|||||||
*/
|
*/
|
||||||
QVariant BlackMisc::fixQVariantFromDbusArgument(const QVariant &variant, int localUserType)
|
QVariant BlackMisc::fixQVariantFromDbusArgument(const QVariant &variant, int localUserType)
|
||||||
{
|
{
|
||||||
if (variant.canConvert<QDBusArgument>())
|
// my business?
|
||||||
|
if (!variant.canConvert<QDBusArgument>()) { return variant; }
|
||||||
|
|
||||||
|
// complex, user type
|
||||||
|
// it has to be made sure, that the cast works
|
||||||
|
const QDBusArgument arg = variant.value<QDBusArgument>();
|
||||||
|
const int userType = static_cast<int>(QVariant::UserType);
|
||||||
|
if (localUserType < userType)
|
||||||
{
|
{
|
||||||
// complex, user type
|
// complex Qt type, e.g. QDateTime
|
||||||
// it has to be made sure, that the cast works
|
return BlackMisc::complexQtTypeFromDbusArgument(arg, localUserType);
|
||||||
const QDBusArgument arg = variant.value<QDBusArgument>();
|
}
|
||||||
if (localUserType < static_cast<int>(QVariant::UserType))
|
else
|
||||||
{
|
{
|
||||||
// complex Qt type, e.g. QDateTime
|
QVariant valueVariant(localUserType, nullptr);
|
||||||
return BlackMisc::complexQtTypeFromDbusArgument(arg, localUserType);
|
auto *meta = Private::getValueObjectMetaInfo(valueVariant);
|
||||||
}
|
if (meta)
|
||||||
else
|
{
|
||||||
{
|
meta->unmarshall(arg, valueVariant.data());
|
||||||
QVariant valueVariant(localUserType, nullptr);
|
return valueVariant;
|
||||||
auto *meta = Private::getValueObjectMetaInfo(valueVariant);
|
}
|
||||||
if (meta)
|
Q_ASSERT_X(false, "fixQVariantFromDbusArgument", "no meta");
|
||||||
{
|
return valueVariant;
|
||||||
meta->unmarshall(arg, valueVariant.data());
|
|
||||||
return valueVariant;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
qWarning() << "fixQVariantFromDbusArgument called with unsupported type";
|
|
||||||
return variant;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user