Fix OAuth2 configuration <--> JSON serialization/deserialization on QT6

This commit is contained in:
Even Rouault 2024-12-02 23:06:06 +01:00 committed by Nyall Dawson
parent 5665665712
commit d42bb6101e
3 changed files with 16 additions and 4 deletions

View File

@ -36,6 +36,7 @@ PyQgsStyleStorageMssql
# To be fixed
PyQgsAnnotation
PyQgsAuthenticationSystem
PyQgsAuthManagerOAuth2OWSTest
PyQgsBlockingProcess
PyQgsCodeEditor
PyQgsDelimitedTextProvider

View File

@ -114,7 +114,6 @@ cmake \
-DWITH_QTSERIALPORT=ON \
-DWITH_QTWEBKIT=${WITH_QT5} \
-DWITH_QTWEBENGINE=${WITH_QTWEBENGINE} \
-DWITH_OAUTH2_PLUGIN=${WITH_QT5} \
-DWITH_PDF4QT=${WITH_PDF4QT} \
-DORACLE_INCLUDEDIR=/instantclient_19_9/sdk/include/ \
-DORACLE_LIBDIR=/instantclient_19_9/ \

View File

@ -43,7 +43,14 @@ namespace QJsonWrapper
QMetaProperty metaproperty = metaObject->property( i );
if ( metaproperty.isReadable() )
{
map[ QLatin1String( metaproperty.name() ) ] = object->property( metaproperty.name() );
QVariant val = object->property( metaproperty.name() );
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
if ( ( val.metaType().flags() & QMetaType::IsEnumeration ) )
{
val.convert( QMetaType::Int );
}
#endif
map[ QLatin1String( metaproperty.name() ) ] = val;
}
}
return map;
@ -60,9 +67,14 @@ namespace QJsonWrapper
if ( property.isValid() )
{
QVariant value = iter.value();
if ( value.canConvert( property.type() ) )
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
const QVariant::Type propertyType = property.type();
#else
const QMetaType propertyType = property.metaType();
#endif
if ( value.canConvert( propertyType ) )
{
value.convert( property.type() );
value.convert( propertyType );
object->setProperty( iter.key().toLatin1(), value );
}
else if ( QString( QLatin1String( "QVariant" ) ).compare( QLatin1String( property.typeName() ) ) == 0 )