Skip to content

Commit

Permalink
Fix OAuth2 configuration <--> JSON serialization/deserialization on QT6
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Dec 2, 2024
1 parent 23a0d71 commit 3022e9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
1 change: 0 additions & 1 deletion .docker/docker-qgis-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,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/ \
Expand Down
19 changes: 16 additions & 3 deletions external/qjsonwrapper/Json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ 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.canConvert( QMetaType::Int ) )
{
val.convert( QMetaType::Int );
}
#endif
map[ QLatin1String( metaproperty.name() ) ] = val;
}
}
return map;
Expand All @@ -60,9 +68,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 )
Expand Down

0 comments on commit 3022e9d

Please sign in to comment.