Skip to content

Commit d42bb61

Browse files
rouaultnyalldawson
authored andcommitted
Fix OAuth2 configuration <--> JSON serialization/deserialization on QT6
1 parent 5665665 commit d42bb61

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

.ci/test_blocklist_qt6.txt

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ PyQgsStyleStorageMssql
3636
# To be fixed
3737
PyQgsAnnotation
3838
PyQgsAuthenticationSystem
39+
PyQgsAuthManagerOAuth2OWSTest
3940
PyQgsBlockingProcess
4041
PyQgsCodeEditor
4142
PyQgsDelimitedTextProvider

.docker/docker-qgis-build.sh

-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ cmake \
114114
-DWITH_QTSERIALPORT=ON \
115115
-DWITH_QTWEBKIT=${WITH_QT5} \
116116
-DWITH_QTWEBENGINE=${WITH_QTWEBENGINE} \
117-
-DWITH_OAUTH2_PLUGIN=${WITH_QT5} \
118117
-DWITH_PDF4QT=${WITH_PDF4QT} \
119118
-DORACLE_INCLUDEDIR=/instantclient_19_9/sdk/include/ \
120119
-DORACLE_LIBDIR=/instantclient_19_9/ \

external/qjsonwrapper/Json.cpp

+15-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ namespace QJsonWrapper
4343
QMetaProperty metaproperty = metaObject->property( i );
4444
if ( metaproperty.isReadable() )
4545
{
46-
map[ QLatin1String( metaproperty.name() ) ] = object->property( metaproperty.name() );
46+
QVariant val = object->property( metaproperty.name() );
47+
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
48+
if ( ( val.metaType().flags() & QMetaType::IsEnumeration ) )
49+
{
50+
val.convert( QMetaType::Int );
51+
}
52+
#endif
53+
map[ QLatin1String( metaproperty.name() ) ] = val;
4754
}
4855
}
4956
return map;
@@ -60,9 +67,14 @@ namespace QJsonWrapper
6067
if ( property.isValid() )
6168
{
6269
QVariant value = iter.value();
63-
if ( value.canConvert( property.type() ) )
70+
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
71+
const QVariant::Type propertyType = property.type();
72+
#else
73+
const QMetaType propertyType = property.metaType();
74+
#endif
75+
if ( value.canConvert( propertyType ) )
6476
{
65-
value.convert( property.type() );
77+
value.convert( propertyType );
6678
object->setProperty( iter.key().toLatin1(), value );
6779
}
6880
else if ( QString( QLatin1String( "QVariant" ) ).compare( QLatin1String( property.typeName() ) ) == 0 )

0 commit comments

Comments
 (0)