mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55: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)
|
||||
{
|
||||
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
|
||||
// it has to be made sure, that the cast works
|
||||
const QDBusArgument arg = variant.value<QDBusArgument>();
|
||||
if (localUserType < static_cast<int>(QVariant::UserType))
|
||||
{
|
||||
// complex Qt type, e.g. QDateTime
|
||||
return BlackMisc::complexQtTypeFromDbusArgument(arg, localUserType);
|
||||
}
|
||||
else
|
||||
{
|
||||
QVariant valueVariant(localUserType, nullptr);
|
||||
auto *meta = Private::getValueObjectMetaInfo(valueVariant);
|
||||
if (meta)
|
||||
{
|
||||
meta->unmarshall(arg, valueVariant.data());
|
||||
return valueVariant;
|
||||
}
|
||||
}
|
||||
// complex Qt type, e.g. QDateTime
|
||||
return BlackMisc::complexQtTypeFromDbusArgument(arg, localUserType);
|
||||
}
|
||||
else
|
||||
{
|
||||
QVariant valueVariant(localUserType, nullptr);
|
||||
auto *meta = Private::getValueObjectMetaInfo(valueVariant);
|
||||
if (meta)
|
||||
{
|
||||
meta->unmarshall(arg, valueVariant.data());
|
||||
return valueVariant;
|
||||
}
|
||||
Q_ASSERT_X(false, "fixQVariantFromDbusArgument", "no meta");
|
||||
return valueVariant;
|
||||
}
|
||||
qWarning() << "fixQVariantFromDbusArgument called with unsupported type";
|
||||
return variant;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user