QtDBus: Use explicitly meta type name instead of method type

In Qt 6, QMetaType sees the underlying type the compiler knows,
so a "using VariantMapMap = QMap<QString, QVariantMap>" typedef
will fail to match a signature of VariantMapMap to QMap<...>
because qDBusParametersForMethod looks for the method type name
whose QMetaType::fromName lookup will fail later.

Pick-to: 6.5
Change-Id: I142dc42ca86aa8a96f73424ec5da5780f2c1e6a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a668ed44dc98a377a5253410d65fe4b3667e87e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Kai Uwe Broulik 2023-10-20 17:36:01 +02:00 committed by Qt Cherry-pick Bot
parent ff1c503dd6
commit e5e8b785cc

View File

@ -103,7 +103,19 @@ bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name)
// sig must be the normalised signature for the method
int qDBusParametersForMethod(const QMetaMethod &mm, QList<QMetaType> &metaTypes, QString &errorMsg)
{
return qDBusParametersForMethod(mm.parameterTypes(), metaTypes, errorMsg);
QList<QByteArray> parameterTypes;
parameterTypes.reserve(mm.parameterCount());
// Not using QMetaMethod::parameterTypes() since we call QMetaType::fromName below
// where we need any typedefs resolved already.
for (int i = 0; i < mm.parameterCount(); ++i) {
QByteArray typeName = mm.parameterMetaType(i).name();
if (typeName.isEmpty())
typeName = mm.parameterTypeName(i);
parameterTypes.append(typeName);
}
return qDBusParametersForMethod(parameterTypes, metaTypes, errorMsg);
}
#endif // QT_BOOTSTRAPPED