diff --git a/mythtv/libs/libmythbase/http/mythhttpmetamethod.cpp b/mythtv/libs/libmythbase/http/mythhttpmetamethod.cpp index 1b49247554e..35844866e37 100644 --- a/mythtv/libs/libmythbase/http/mythhttpmetamethod.cpp +++ b/mythtv/libs/libmythbase/http/mythhttpmetamethod.cpp @@ -91,7 +91,11 @@ MythHTTPMetaMethod::MythHTTPMetaMethod(int Index, QMetaMethod& Method, int Reque // Add type/value for each method parameter for (int i = 0; i < names.size(); ++i) { +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) int type = QMetaType::type(types[i]); +#else + int type = QMetaType::fromName(types[i]).id(); +#endif // Discard methods that use unsupported parameter types. // Note: slots only - these are supportable for signals @@ -127,16 +131,30 @@ HTTPMethodPtr MythHTTPMetaMethod::Create(int Index, QMetaMethod &Method, int Req void* MythHTTPMetaMethod::CreateParameter(void* Parameter, int Type, const QString& Value) { // Enum types - if (auto typeflags = QMetaType::typeFlags(Type); (typeflags & QMetaType::IsEnumeration) == QMetaType::IsEnumeration) +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) + auto typeflags = QMetaType::typeFlags(Type); +#else + auto typeflags = QMetaType(Type).flags(); +#endif + if ((typeflags & QMetaType::IsEnumeration) == QMetaType::IsEnumeration) { // QMetaEnum::keyToValue will return -1 for an unrecognised enumerant, so // default to -1 for all error cases int value = -1; +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) QByteArray type = QMetaType::typeName(Type); +#else + QByteArray type = QMetaType(Type).name(); +#endif if (int index = type.lastIndexOf("::" ); index > -1) { QString enumname = type.mid(index + 2); - if (const auto * metaobject = QMetaType::metaObjectForType(Type); metaobject) +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) + const auto * metaobject = QMetaType::metaObjectForType(Type); +#else + const auto * metaobject = QMetaType(Type).metaObject(); +#endif + if (metaobject) { int enumindex = metaobject->indexOfEnumerator(enumname.toUtf8()); if (enumindex >= 0) @@ -190,7 +208,13 @@ QVariant MythHTTPMetaMethod::CreateReturnValue(int Type, void* Value) // This assumes any user type will be derived from QObject... // (Exception for QFileInfo) - if (Type == QMetaType::type("QFileInfo")) + if ( +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) + Type == QMetaType::type("QFileInfo") +#else + Type == QMetaType::fromName("QFileInfo").id() +#endif + ) return QVariant::fromValue(*(static_cast(Value))); if (Type > QMetaType::User) diff --git a/mythtv/libs/libmythbase/http/mythwsdl.cpp b/mythtv/libs/libmythbase/http/mythwsdl.cpp index 4410b84f29b..1e5ee5bb373 100644 --- a/mythtv/libs/libmythbase/http/mythwsdl.cpp +++ b/mythtv/libs/libmythbase/http/mythwsdl.cpp @@ -323,7 +323,11 @@ QDomElement MythWSDL::CreateBindingOperation( QString path, HTTPMethodPtr handle oDirection.appendChild( oNode ); oOp.appendChild( oDirection ); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) const char * typeName = QMetaType::typeName(handler->m_types[0]); +#else + const char * typeName = QMetaType(handler->m_types[0]).name(); +#endif if (QString::compare(typeName, "void", Qt::CaseInsensitive ) != 0) { @@ -390,7 +394,11 @@ QDomElement MythWSDL::CreateMethodType( HTTPMethodPtr handler, QDomElement oNode = createElement( "xs:element" ); // QString sType = oInfo.m_oMethod.typeName(); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) const char * typeName = QMetaType::typeName(handler->m_types[0]); +#else + const char * typeName = QMetaType(handler->m_types[0]).name(); +#endif QString sType(typeName); // if (sType.startsWith("V2")) @@ -439,7 +447,11 @@ QDomElement MythWSDL::CreateMethodType( HTTPMethodPtr handler, { auto name = handler->m_names[count]; paramNames.append(name.toUtf8()); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) const char * typeName = QMetaType::typeName(handler->m_types[count]); +#else + const char * typeName = QMetaType(handler->m_types[count]).name(); +#endif paramTypes.append(QByteArray(typeName)); }