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 authored and nyalldawson committed Dec 3, 2024
1 parent 5665665 commit d42bb61
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions .ci/test_blocklist_qt6.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ PyQgsStyleStorageMssql
# To be fixed
PyQgsAnnotation
PyQgsAuthenticationSystem
PyQgsAuthManagerOAuth2OWSTest
PyQgsBlockingProcess
PyQgsCodeEditor
PyQgsDelimitedTextProvider
Expand Down
1 change: 0 additions & 1 deletion .docker/docker-qgis-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/ \
Expand Down
18 changes: 15 additions & 3 deletions external/qjsonwrapper/Json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 )
Expand Down

0 comments on commit d42bb61

Please sign in to comment.