diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ad5d5d34ab0..4ff9b6de55d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -733,6 +733,7 @@ if(MSVC) add_definitions(-DNOMINMAX) endif() +set (WITH_PYSIDE FALSE CACHE BOOL "Enable (experimental) PySide support") if (WITH_PYSIDE) # Copied from git://code.qt.io/pyside/pyside-setup.git in shiboken6/cmake/ShibokenSetup.cmake @@ -1027,6 +1028,9 @@ set(QGIS_INSTALL_SYS_LIBS TRUE CACHE BOOL "If set to TRUE install all required s set(MIN_QGIS_PYTHON_VERSION "3.7") set(Python_FIND_FRAMEWORK "LAST") +if (WITH_BINDINGS AND WITH_PYSIDE) + message(FATAL_ERROR "Cannot enable WITH_PYSIDE and WITH_BINDINGS together") +endif() if (WITH_BINDINGS OR WITH_PYSIDE) find_package(Python ${MIN_PYTHON_VERSION} REQUIRED COMPONENTS Interpreter Development) @@ -1038,17 +1042,6 @@ message("-- Found Python executable: ${Python_EXECUTABLE} (version ${Python_VERS message("-- Python library: ${Python_LIBRARIES}") message("-- Python site-packages: ${Python_SITEARCH}") -set (WITH_PYSIDE FALSE CACHE BOOL "Enable (experimental) PySide support") -if (WITH_PYSIDE) - if (WITH_BINDINGS) - message(FATAL_ERROR "Cannot enable WITH_PYSIDE and WITH_BINDINGS together") - endif() - set(PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/qt-for-python) - set(QGIS_PYTHON_OUTPUT_DIRECTORY ${PYTHON_OUTPUT_DIRECTORY}/qgis) - add_subdirectory(qt-for-python) - add_subdirectory(python/testing) -endif() - if (WITH_CORE AND WITH_BINDINGS) set(PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python) set (QGIS_PYTHON_OUTPUT_DIRECTORY ${PYTHON_OUTPUT_DIRECTORY}/qgis) @@ -1139,6 +1132,11 @@ if (WITH_CORE) if (WITH_BINDINGS) add_subdirectory(python) + elseif (WITH_PYSIDE) + set(PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/qt-for-python) + set(QGIS_PYTHON_OUTPUT_DIRECTORY ${PYTHON_OUTPUT_DIRECTORY}/qgis) + add_subdirectory(qt-for-python) + add_subdirectory(python/testing) endif() if (APPLE) diff --git a/external/shiboken_apiextractor/clangparser/clangbuilder.cpp b/external/shiboken_apiextractor/clangparser/clangbuilder.cpp index a01f2d61e3db..879c9d53c575 100644 --- a/external/shiboken_apiextractor/clangparser/clangbuilder.cpp +++ b/external/shiboken_apiextractor/clangparser/clangbuilder.cpp @@ -12,10 +12,8 @@ #include #include -#include #include #include -#include #include #include #include @@ -127,67 +125,6 @@ namespace clang explicit BuilderPrivate( BaseVisitor *bv ) : m_baseVisitor( bv ), m_model( new CodeModel ) { m_scopeStack.push( NamespaceModelItem( new _FileModelItem( m_model ) ) ); - - // collect #ifndef SIP_RUN - - // TODO fix the path when we get the qgis dir as argument - QString dir( QStringLiteral( "/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core" ) ); - QDirIterator it( dir, QStringList() << QStringLiteral( "*.h" ), QDir::Files, QDirIterator::Subdirectories ); - while ( it.hasNext() ) - { - const QString fileName = it.next(); - QFile file( fileName ); - if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) ) - { - qWarning() << "Error: failed to read file " << fileName; - break; - } - - QTextStream in( &file ); - int numLine = 1; - int startIfndef = -1; - const QRegularExpression reIf( QStringLiteral( "^\\s*#if" ) ); - const QRegularExpression reEndIf( QStringLiteral( "^\\s*#(endif|else)" ) ); - const QRegularExpression reIfndef( QStringLiteral( "^\\s*#ifndef\\s*SIP_RUN" ) ); - SkipRanges ranges; - int nbIf = 0; - while ( !in.atEnd() ) - { - QString line = in.readLine(); - - if ( startIfndef >= 0 ) - { - if ( reIf.match( line ).hasMatch() ) - { - nbIf++; - } - - if ( reEndIf.match( line ).hasMatch() ) - { - if ( nbIf == 1 ) - { - ranges << SkipRange( startIfndef, numLine ); - startIfndef = -1; - } - - nbIf--; - } - } - else - { - if ( reIfndef.match( line ).hasMatch() ) - { - nbIf++; - startIfndef = numLine; - } - } - - numLine++; - } - - if ( !ranges.isEmpty() ) - mSkipRanges[ fileName ] = ranges; - } } ~BuilderPrivate() { @@ -255,19 +192,11 @@ namespace clang void setFileName( const CXCursor &cursor, _CodeModelItem *item ); - bool isSkipped( const CXCursor &cursor ) const; - BaseVisitor *m_baseVisitor; CodeModel *m_model; - QMap> m_sipSkip; - QStack m_scopeStack; QStringList m_scope; - typedef QPair SkipRange; - typedef QList SkipRanges; - QMap mSkipRanges; - // Store all classes by cursor so that base classes can be found and inner // classes can be correctly parented in case of forward-declared inner classes // (QMetaObject::Connection) @@ -296,16 +225,6 @@ namespace clang bool BuilderPrivate::addClass( const CXCursor &cursor, CodeModel::ClassType t ) { QString className = getCursorSpelling( cursor ); - - QStringList bindedClasses = QStringList() - << QStringLiteral( "QgsAttributes" ) // TODO has to be mapped to a list through using method code - << QStringLiteral( "QgsField" ) - << QStringLiteral( "QgsFields" ); - - // TODO bind everything - if ( !bindedClasses.contains( className ) ) - return false; - m_currentClass.reset( new _ClassModelItem( m_model, className ) ); setFileName( cursor, m_currentClass.get() ); m_currentClass->setClassType( t ); @@ -478,9 +397,6 @@ namespace clang result->setStatic( clang_CXXMethod_isStatic( cursor ) != 0 ); result->setVirtual( clang_CXXMethod_isVirtual( cursor ) != 0 ); result->setAbstract( clang_CXXMethod_isPureVirtual( cursor ) != 0 ); - - result->setSkipped( isSkipped( cursor ) ); - return result; } @@ -899,30 +815,6 @@ namespace clang } } - bool BuilderPrivate::isSkipped( const CXCursor &cursor ) const - { - SourceLocation loc = getCursorLocation( cursor ); - QString fileName = getFileName( loc.file ); - const int line = loc.line; - - // TODO fix the path when we get the qgis dir as argument - if ( !fileName.startsWith( QStringLiteral( "/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/" ) ) - || ( m_sipSkip.contains( fileName ) && m_sipSkip[fileName].contains( line ) ) ) - return true; - - else if ( mSkipRanges.contains( fileName ) ) - { - const SkipRanges ranges = mSkipRanges[fileName]; - for ( SkipRange range : ranges ) - { - if ( range.first <= line && range.second >= line ) - return true; - } - } - - return false; - } - Builder::Builder() { d = new BuilderPrivate( this ); @@ -1001,186 +893,7 @@ namespace clang bool Builder::visitLocation( const QString &fileName, LocationType locationType ) const { - QStringList sipNoFiles = - { - u"raster/qgsrasterlayerrenderer.h"_s, - u"raster/qgsrasterrendererregistry.h"_s, - u"raster/qgsrasterlayerprofilegenerator.h"_s, - u"qgsthreadingutils.h"_s, - u"pal/palrtree.h"_s, - u"pal/geomfunction.h"_s, - u"pal/internalexception.h"_s, - u"pal/util.h"_s, - u"pal/labelposition.h"_s, - u"pal/pointset.h"_s, - u"pal/palstat.h"_s, - u"pal/feature.h"_s, - u"pal/pal.h"_s, - u"pal/priorityqueue.h"_s, - u"pal/layer.h"_s, - u"pal/palexception.h"_s, - u"pal/costcalculator.h"_s, - u"pal/problem.h"_s, - u"qgsgenericspatialindex.h"_s, - u"browser/qgsfilebaseddataitemprovider.h"_s, - u"qgsgrouplayerrenderer.h"_s, - u"qgslocalec.h"_s, - u"qgsspatialindexkdbush_p.h"_s, - u"proj/qgscoordinatetransformcontext_p.h"_s, - u"proj/qgscoordinatetransform_p.h"_s, - u"maprenderer/qgsmaprendererstagedrenderjob.h"_s, - u"qgsmbtiles.h"_s, - u"qgseventtracing.h"_s, - u"auth/qgsauthmethodregistry.h"_s, - u"auth/qgsauthmethodmetadata.h"_s, - u"auth/qgsauthcrypto.h"_s, - u"qgsfield_p.h"_s, - u"qgspointlocatorinittask.h"_s, - u"qobjectuniqueptr.h"_s, - u"geometry/qgsinternalgeometryengine.h"_s, - u"geometry/qgsgeos.h"_s, - u"geometry/qgsgeometryeditutils.h"_s, - u"geometry/qgsgeometryfactory.h"_s, - u"qgstilecache.h"_s, - u"qgswebview.h"_s, - u"network/qgsrangerequestcache.h"_s, - u"network/qgsnetworkdiskcache.h"_s, - u"network/qgsnetworkreplyparser.h"_s, - u"layout/qgslayoutmultiframeundocommand.h"_s - u"layout/qgscompositionconverter.h"_s, - u"layout/qgslayoutitemundocommand.h"_s, - u"layout/qgslayoutgeopdfexporter.h"_s, - u"layout/qgslayoutitemgroupundocommand.h"_s, - u"mesh/qgsmeshdatasetgroupstore.h"_s, - u"mesh/qgsmeshlayerprofilegenerator.h"_s, - u"mesh/qgstopologicalmesh.h"_s, - u"mesh/qgsmeshlayerutils.h"_s, - u"mesh/qgsmeshlayerrenderer.h"_s, - u"mesh/qgsmeshvirtualdatasetgroup.h"_s, - u"mesh/qgsmeshcalcnode.h"_s, - u"mesh/qgsmeshcalcutils.h"_s, - u"mesh/qgstriangularmesh.h"_s, - u"mesh/qgsmeshsimplificationsettings.h"_s, - u"mesh/qgsmeshvectorrenderer.h"_s, - u"qgsfeatureexpressionvaluesgatherer.h"_s, - u"qgsindexedfeature.h"_s, - u"qgsrelation_p.h"_s, - u"qgspolymorphicrelation_p.h"_s, - u"settings/qgssettingsentryenumflag.h"_s, - u"textrenderer/qgstextmetrics.h"_s, - u"textrenderer/qgstextrenderer_p.h"_s, - u"expression/qgsexpressionutils.h"_s, - u"symbology/qgspainterswapper.h"_s, - u"qgswebpage.h"_s, - u"qgstiledownloadmanager.h"_s, - u"qgssqliteexpressioncompiler.h"_s, - u"qgsshapegenerator.h"_s, - u"qgis_sip.h"_s, - u"qgsgdalutils.h"_s, - u"pointcloud/qgspointcloudrequest.h"_s, - u"pointcloud/qgspointcloudstatscalculator.h"_s, - u"pointcloud/qgspointcloudblockrequest.h"_s, - u"pointcloud/qgscopcpointcloudindex.h"_s, - u"pointcloud/qgspointcloudlayerprofilegenerator.h"_s, - u"pointcloud/qgsremotecopcpointcloudindex.h"_s, - u"pointcloud/qgseptpointcloudindex.h"_s, - u"pointcloud/qgslazdecoder.h"_s, - u"pointcloud/qgspointcloudstatscalculationtask.h"_s, - u"pointcloud/qgspointcloudlayerrenderer.h"_s, - u"pointcloud/expression/qgspointcloudexpression.h"_s, - u"pointcloud/expression/qgspointcloudexpressionnode.h"_s, - u"pointcloud/expression/qgspointcloudexpressionnodeimpl.h"_s, - u"pointcloud/qgseptpointcloudblockrequest.h"_s, - u"pointcloud/qgscopcpointcloudblockrequest.h"_s, - u"pointcloud/qgsremoteeptpointcloudindex.h"_s, - u"pointcloud/qgspointcloudsubindex.h"_s, - u"pointcloud/qgseptdecoder.h"_s, - u"pointcloud/qgspointcloudindex.h"_s, - u"pointcloud/qgslazinfo.h"_s, - u"dxf/qgsdxfpaintengine.h"_s, - u"dxf/qgsdxfpaintdevice.h"_s, - u"elevation/qgsabstractprofilesurfacegenerator.h"_s, - u"vectortile/qgsvectortilemvtencoder.h"_s, - u"vectortile/qgsvectortiledataitems.h"_s, - u"vectortile/qgsvectortilemvtdecoder.h"_s, - u"vectortile/qgsvectortiledataprovider.h"_s, - u"vectortile/qgsvectortileconnection.h"_s, - u"vectortile/qgsvtpkvectortiledataprovider.h"_s, - u"vectortile/qgsarcgisvectortileservicedataprovider.h"_s, - u"vectortile/qgsxyzvectortiledataprovider.h"_s, - u"vectortile/qgsvectortilemvtutils.h"_s, - u"vectortile/qgsvectortileutils.h"_s, - u"vectortile/qgsvectortilelayerrenderer.h"_s, - u"vectortile/qgsmbtilesvectortiledataprovider.h"_s, - u"vectortile/qgsvectortileprovidermetadata.h"_s, - u"vectortile/qgsvectortileloader.h"_s, - u"qgsconnectionpool.h"_s, - u"qgsogrutils.h"_s, - u"qgsspatialindexutils.h"_s, - u"providers/ogr/qgsgeopackageprojectstorage.h"_s, - u"providers/ogr/qgsogrprovidermetadata.h"_s, - u"providers/ogr/qgsogrdbconnection.h"_s, - u"providers/ogr/qgsogrfeatureiterator.h"_s, - u"providers/ogr/qgsogrlayermetadataprovider.h"_s, - u"providers/ogr/qgsgeopackagedataitems.h"_s, - u"providers/ogr/qgsogrproviderconnection.h"_s, - u"providers/ogr/qgsogrexpressioncompiler.h"_s, - u"providers/ogr/qgsgeopackageproviderconnection.h"_s, - u"providers/ogr/qgsogrprovider.h"_s, - u"providers/ogr/qgsogrconnpool.h"_s, - u"providers/ogr/qgsgeopackagerasterwriter.h"_s, - u"providers/ogr/qgsogrproviderutils.h"_s, - u"providers/ogr/qgsogrtransaction.h"_s, - u"providers/ogr/qgsgeopackagerasterwritertask.h"_s, - u"providers/gdal/qgsgdalprovider.h"_s, - u"providers/gdal/qgsgdalproviderbase.h"_s, - u"providers/copc/qgscopcprovider.h"_s, - u"providers/meshmemory/qgsmeshmemorydataprovider.h"_s, - u"providers/ept/qgseptprovider.h"_s, - u"providers/vpc/qgsvirtualpointcloudprovider.h"_s, - u"providers/memory/qgsmemoryfeatureiterator.h"_s, - u"providers/memory/qgsmemoryprovider.h"_s, - u"providers/arcgis/qgsarcgisrestquery.h"_s, - u"fromencodedcomponenthelper.h"_s, - u"qgswebframe.h"_s, - u"externalstorage/qgshttpexternalstorage_p.h"_s, - u"externalstorage/qgssimplecopyexternalstorage_p.h"_s, - u"vector/qgsvectorlayerdiagramprovider.h"_s, - u"vector/qgsvectorlayerrenderer.h"_s, - u"vector/qgsvectorlayerref.h"_s, - u"vector/qgsvectorlayerprofilegenerator.h"_s, - u"qgsabstractgeopdfexporter.h"_s, - u"processing/qgsprocessingparametertypeimpl.h"_s, - u"qgscplhttpfetchoverrider.h"_s, - u"qgsopenclutils.h"_s, - u"qgsproperty_p.h"_s, - u"qgsspatialiteutils.h"_s, - u"qgscoordinateutils.h"_s, - u"simplify/effectivearea.h"_s, - u"labeling/qgslabelsink.h"_s, - u"labeling/qgsvectorlayerlabelprovider.h"_s, - u"labeling/qgslabelfeature.h"_s, - u"labeling/qgstextlabelfeature.h"_s, - u"labeling/qgslabelingengine.h"_s, - u"qgssqlexpressioncompiler.h"_s, - u"annotations/qgsannotationlayerrenderer.h"_s, - u"annotations/qgsannotationregistry.h"_s, - u"qgsogrproxytextcodec.h"_s, - u"qgsexception.h"_s, - u"qgsmaplayerref.h"_s - }; - - QString baseName = fileName; - baseName.remove( u"/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/"_s ); - - if ( sipNoFiles.contains( baseName ) ) - { - // qDebug() << "--- remove " << fileName; - return false; - } - - // qDebug() << "fileName=" << fileName << "visit?" << !fileName.contains(u"qgsogrutils.h"_s); - return !fileName.contains( u"qgsogrutils.h"_s ) && ( locationType != LocationType::System || d->visitHeader( fileName ) ); + return locationType != LocationType::System || d->visitHeader( fileName ); } void Builder::setSystemIncludes( const QStringList &systemIncludes ) @@ -1253,18 +966,6 @@ namespace clang { switch ( cursor.kind ) { - case CXCursor_MacroExpansion: - { - QString macro = getCursorSpelling( cursor ); - if ( macro == u"SIP_SKIP" ) - { - // try getCursorRange if on several lines - SourceLocation loc = getCursorLocation( cursor ); - QString fileName = getFileName( loc.file ); - d->m_sipSkip[fileName].append( loc.line ); - } - } - break; case CXCursor_CXXAccessSpecifier: d->m_currentFunctionType = CodeModel::Normal; break; @@ -1386,10 +1087,8 @@ namespace clang if ( d->m_withinFriendDecl || !withinClassDeclaration( cursor ) ) return Skip; d->m_currentFunction = d->createMemberFunction( cursor, false ); - d->m_currentFunction->setSkipped( d->isSkipped( cursor ) ); d->m_scopeStack.back()->addFunction( d->m_currentFunction ); break; - // Not fully supported, currently, seen as normal function // Note: May appear inside class (member template) or outside (free template). case CXCursor_FunctionTemplate: @@ -1400,26 +1099,16 @@ namespace clang if ( semParent == clang_getCursorLexicalParent( cursor ) ) { d->m_currentFunction = d->createMemberFunction( cursor, true ); - d->m_currentFunction->setSkipped( d->isSkipped( cursor ) ); d->m_scopeStack.back()->addFunction( d->m_currentFunction ); break; } return Skip; // inline member functions outside class } - - if ( !d->isSkipped( cursor ) ) - { - d->m_currentFunction = d->createFunction( cursor, CodeModel::Normal, true ); - d->m_scopeStack.back()->addFunction( d->m_currentFunction ); - return Skip; - } } + d->m_currentFunction = d->createFunction( cursor, CodeModel::Normal, true ); + d->m_scopeStack.back()->addFunction( d->m_currentFunction ); break; case CXCursor_FunctionDecl: - - if ( d->isSkipped( cursor ) ) - return Skip; - // Free functions or functions completely defined within "friend" (class // operators). Note: CXTranslationUnit_SkipFunctionBodies must be off for // clang_isCursorDefinition() to work here. @@ -1438,17 +1127,10 @@ namespace clang d->m_scopeStack.at( scope )->addFunction( d->m_currentFunction ); } break; - case CXCursor_Namespace: { - - // TODO failing to generate namespace (when there is function maybe?) because it generated an inti_Nmaespace() call - // maybe related to this https://bugreports.qt.io/browse/PYSIDE-1075 - // Qt namespace work with the same declaration function - return Skip; - const auto type = namespaceType( cursor ); - if ( type == NamespaceType::Anonymous || d->isSkipped( cursor ) ) + if ( type == NamespaceType::Anonymous ) return Skip; const QString name = getCursorSpelling( cursor ); const auto parentNamespaceItem = std::dynamic_pointer_cast<_NamespaceModelItem>( d->m_scopeStack.back() ); diff --git a/external/shiboken_apiextractor/clangparser/clangparser.cpp b/external/shiboken_apiextractor/clangparser/clangparser.cpp index 42e7f042b7f9..bebd8f8d503e 100644 --- a/external/shiboken_apiextractor/clangparser/clangparser.cpp +++ b/external/shiboken_apiextractor/clangparser/clangparser.cpp @@ -158,9 +158,6 @@ namespace clang locationType = LocationType::Other; } - // qDebug() << "fileName=" << fileName << "locationType=" << static_cast(locationType); - - m_currentCxFile = cxFile; m_visitCurrent = visitLocation( fileName, locationType ); return m_visitCurrent; @@ -310,7 +307,7 @@ namespace clang CXTranslationUnit translationUnit = createTranslationUnit( index, clangArgs, addCompilerSupportArguments, - clangFlags | CXTranslationUnit_DetailedPreprocessingRecord ); + clangFlags ); if ( !translationUnit ) return false; diff --git a/external/shiboken_apiextractor/parser/codemodel.cpp b/external/shiboken_apiextractor/parser/codemodel.cpp index f726fb982c5e..b720a0f475e6 100644 --- a/external/shiboken_apiextractor/parser/codemodel.cpp +++ b/external/shiboken_apiextractor/parser/codemodel.cpp @@ -1084,16 +1084,6 @@ void _FunctionModelItem::setAbstract( bool isAbstract ) m_isAbstract = isAbstract; } -void _FunctionModelItem::setSkipped( bool isSkipped ) -{ - m_isSkipped = isSkipped; -} - -bool _FunctionModelItem::isSkipped() const -{ - return m_isSkipped; -} - // Qt bool _FunctionModelItem::isInvokable() const { diff --git a/external/shiboken_apiextractor/parser/codemodel.h b/external/shiboken_apiextractor/parser/codemodel.h index 7370b1a2c1ac..b65bf1355e57 100644 --- a/external/shiboken_apiextractor/parser/codemodel.h +++ b/external/shiboken_apiextractor/parser/codemodel.h @@ -541,9 +541,6 @@ class _FunctionModelItem: public _MemberModelItem // Private, for usage by the clang builder. void _determineType(); - void setSkipped( bool isSkipped ); - bool isSkipped() const; - #ifndef QT_NO_DEBUG_STREAM void formatDebug( QDebug &d ) const override; #endif @@ -568,7 +565,6 @@ class _FunctionModelItem: public _MemberModelItem uint m_isVariadics: 1; uint m_isHiddenFriend: 1; uint m_isInvokable : 1; // Qt - uint m_isSkipped : 1; }; uint m_flags; }; diff --git a/qt-for-python/CMakeLists.txt b/qt-for-python/CMakeLists.txt index 8d7f063a76b9..60aba8f06b28 100644 --- a/qt-for-python/CMakeLists.txt +++ b/qt-for-python/CMakeLists.txt @@ -2,13 +2,6 @@ add_subdirectory(typesystem_generator) - -set(_warnings "") -string(REPLACE "-Werror" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) -message(${CMAKE_CXX_FLAGS}) - - - set(PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/qt-for-python) set (QGIS_PYTHON_OUTPUT_DIRECTORY ${PYTHON_OUTPUT_DIRECTORY}/qgis) diff --git a/qt-for-python/qgis/__init__.py b/qt-for-python/qgis/__init__.py index aa8a4d2521d7..4471327e394b 100644 --- a/qt-for-python/qgis/__init__.py +++ b/qt-for-python/qgis/__init__.py @@ -1,8 +1,8 @@ __all__ = ['core'] -# Preload PySide2 libraries to avoid missing libraries while loading our module +# Preload PySide libraries to avoid missing libraries while loading our module try: - from PySide2 import QtCore + from PySide6 import QtCore except Exception: print("Failed to load PySide") raise diff --git a/qt-for-python/qgis/core/CMakeLists.txt b/qt-for-python/qgis/core/CMakeLists.txt index e8ade5cb895b..412f5b192ba1 100644 --- a/qt-for-python/qgis/core/CMakeLists.txt +++ b/qt-for-python/qgis/core/CMakeLists.txt @@ -1,98 +1,58 @@ -set(pyqgis_core_OBJECT_CLASSES - QgsEditorWidgetSetup - QgsFieldModel - QgsFieldProxyModel - QgsFeedback - QgsRenderContext - QgsFeatureSource - QgsMapLayerRenderer - QgsTemporalRangeObject - QgsExpressionContextGenerator - QgsExpressionContextScopeGenerator - QgsDataProvider - QgsProjectTranslator - QgsFeatureSink - QgsMessageLog - QgsRasterInterface - QgsRasterBlock -) - -set(pyqgis_core_VALUE_CLASSES - QgsAttributes - QgsFeature - QgsExpressionContext - QgsFeatureIterator - QgsFeatureRequest - QgsCoordinateTransformContext - QgsReadWriteContext - QgsAction - QgsRectangle - QgsDefaultValue - QgsRenderChecker - QgsPointXY -) - -# Auto-Generate files - every class will have a cpp and h file -set(pyqgis_core_SRC - # global module wrapper - ${CMAKE_CURRENT_BINARY_DIR}/core/core_module_wrapper.cpp - ${CMAKE_CURRENT_BINARY_DIR}/core/core_python.h - - ${CMAKE_CURRENT_BINARY_DIR}/core/qgswkbtypes_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgswkbtypes_wrapper.cpp - - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsgeometry_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsgeometry_wrapper.cpp - - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsunittypes_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsunittypes_wrapper.cpp - - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsexpressioncontextscope_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsexpressioncontextscope_wrapper.cpp - - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsmaplayer_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsmaplayer_wrapper.cpp +# call typesystem_generator to generate binding - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsproject_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsproject_wrapper.cpp +# TODO Where does qgis_core_global.h comes from ? we need to generate it +set(TYPESYSTEM_FILE "${CMAKE_SOURCE_DIR}/qt-for-python/qgis/core/typesystem_generated.xml") +set(SNIPPET_FILE "${CMAKE_SOURCE_DIR}/qt-for-python/qgis/core/qgis_core.cpp") +set(CLASSBLOCKLIST_FILE "${CMAKE_SOURCE_DIR}/qt-for-python/qgis/core/classBlockList.txt") - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsfield_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsfield_wrapper.cpp +set(TYPESYSTEM_GENERATOR_ARGS "") +get_target_property(INCLUDE_DIRS qgis_core INCLUDE_DIRECTORIES) +list(TRANSFORM INCLUDE_DIRS PREPEND "-I") - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsfields_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsfields_wrapper.cpp - - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsfieldconstraints_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsfieldconstraints_wrapper.cpp +add_custom_target(update_pyside_bindings + COMMAND $ --output-file="${TYPESYSTEM_FILE}" --snippet-file=${SNIPPET_FILE} --class-block-list-file ${CLASSBLOCKLIST_FILE} -- ${INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/qgis_core_global.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS typesystem_generator + ) - ${CMAKE_CURRENT_BINARY_DIR}/core/qgscoordinatereferencesystem_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgscoordinatereferencesystem_wrapper.cpp +# TODO restart this code if typesystem has been modified +# Get src code from typesystem file +set(pyqgis_core_SRC - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsabstractfeaturesource_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsabstractfeaturesource_wrapper.cpp + # global module wrapper + ${CMAKE_CURRENT_BINARY_DIR}/core/core_module_wrapper.cpp + ${CMAKE_CURRENT_BINARY_DIR}/core/core_python.h +) - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsapplication_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsapplication_wrapper.cpp +file(STRINGS ${TYPESYSTEM_FILE} TYPESYSTEM_CONTENT) - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsvectorlayer_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsvectorlayer_wrapper.cpp +# Parse typesystem file to generate the sources files to build +list(FILTER TYPESYSTEM_CONTENT INCLUDE REGEX "namespace-type|value-type|object-type") +foreach(LINE ${TYPESYSTEM_CONTENT}) - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsvectordataprovider_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsvectordataprovider_wrapper.cpp + string(REGEX MATCH "" END_ITEM ${LINE} ) + if (END_ITEM) + list(POP_BACK TS_ITEMS _) + endif() - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsrasterblockfeedback_wrapper.h - ${CMAKE_CURRENT_BINARY_DIR}/core/qgsrasterblockfeedback_wrapper.cpp -) + list(APPEND pyqgis_core_SRC + ${CMAKE_CURRENT_BINARY_DIR}/core/${ITEM_NAME}_wrapper.cpp + ${CMAKE_CURRENT_BINARY_DIR}/core/${ITEM_NAME}_wrapper.h) + endif () +endforeach() # The includes are needed to parse and build classes specified in our typesystem set(pyqgis_core_include_paths @@ -137,34 +97,17 @@ endif() # Dependencies - changes on these files should trigger new bindings set(pyqgis_core_DEPENDS -# ${CMAKE_SOURCE_DIR}/src/core/geometry/qgswkbtypes.h + ${TYPESYSTEM_FILE} + ${SNIPPET_FILE} ) -set(TYPESYSTEM_CONTENT "") -set(GLOBAL_HEADER_CONTENT "") -foreach(class ${pyqgis_core_OBJECT_CLASSES}) - string(TOLOWER ${class} class_lower) -# set(pyqgis_core_DEPENDS "${pyqgis_core_DEPENDS} ${CMAKE_SOURCE_DIR}/src/core/${class_lower}.h") - list(APPEND pyqgis_core_SRC "${CMAKE_CURRENT_BINARY_DIR}/core/${class_lower}_wrapper.h" "${CMAKE_CURRENT_BINARY_DIR}/core/${class_lower}_wrapper.cpp") - set(GLOBAL_HEADER_CONTENT "${GLOBAL_HEADER_CONTENT}\n#include <${class_lower}.h>") - set(TYPESYSTEM_CONTENT "${TYPESYSTEM_CONTENT}\n ") -endforeach() -set(TYPESYSTEM_CONTENT "${TYPESYSTEM_CONTENT}\n\n") -foreach(class ${pyqgis_core_VALUE_CLASSES}) - string(TOLOWER ${class} class_lower) -# set(pyqgis_core_DEPENDS "${pyqgis_core_DEPENDS} ${CMAKE_SOURCE_DIR}/src/core/${class_lower}.h") - list(APPEND pyqgis_core_SRC "${CMAKE_CURRENT_BINARY_DIR}/core/${class_lower}_wrapper.h" "${CMAKE_CURRENT_BINARY_DIR}/core/${class_lower}_wrapper.cpp") - set(GLOBAL_HEADER_CONTENT "${GLOBAL_HEADER_CONTENT}\n#include <${class_lower}.h>") - set(TYPESYSTEM_CONTENT "${TYPESYSTEM_CONTENT}\n ") -endforeach() - if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") set_source_files_properties( ${pyqgis_core_SRC} PROPERTIES COMPILE_FLAGS "-Wno-missing-field-initializers -Wno-cast-function-type -Wno-unused-parameter") endif() -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qgis_core_global.h.in ${CMAKE_CURRENT_BINARY_DIR}/qgis_core_global.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qgis_core_global.h ${CMAKE_CURRENT_BINARY_DIR}/qgis_core_global.h COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/typesystem_qgis_core.xml.in ${CMAKE_CURRENT_BINARY_DIR}/typesystem_qgis_core.xml) CREATE_PYTHON_BINDINGS( diff --git a/qt-for-python/qgis/core/classBlockList.txt b/qt-for-python/qgis/core/classBlockList.txt new file mode 100644 index 000000000000..f74e944bd0e6 --- /dev/null +++ b/qt-for-python/qgis/core/classBlockList.txt @@ -0,0 +1,171 @@ +QgsAbstractGeometrySimplifier +QgsContrastEnhancementFunction +QgsLinearMinMaxEnhancement +QgsExpressionFunction +QgsScopedExpressionFunction +QgsInterval +QgsMapLayerServerProperties +QgsReadWriteContextCategoryPopper +QgsHttpHeaders +QgsFeatureRenderer +QgsAbstractPropertyCollection +QgsAbstractVectorLayerLabeling +QgsGplColorScheme +QgsPresetSchemeColorRamp +QgsRasterIterator +QgsClipToMinMaxEnhancement +QgsRasterResamplerV2 +QgsTaskManager +QgsRasterFileWriterTask +QgsContrastEnhancement +QgsRasterPipe +QgsLinearMinMaxEnhancementWithClip +QgsSingleBandGrayRenderer +QgsMapLayerTemporalProperties +QgsSingleBandPseudoColorRenderer +QgsRasterIdentifyResult +QgsRelation +QgsCurve +QgsScaleBarRenderer +QgsAbstract3DRenderer +QgsAbstractPointCloud3DRenderer +Qgs3DRendererAbstractMetadata +Qgs3DSymbolAbstractMetadata +QgsSettingsEntryBase +QgsSettingsEntryVariant +QgsSettingsEntryString +QgsSettingsEntryStringList +QgsSettingsEntryBool +QgsSettingsEntryInteger +QgsSettingsEntryDouble +QgsSettingsEntryColor +QgsSettingsEntryVariantMap +QgsNetworkAccessManager +QgsNetworkContentFetcherTask +QgsSourceCache +QgsVectorLayerFeatureIterator +QgsMeshDataset +QgsMeshDatasetGroup +QgsMeshDataSourceInterface +QgsMeshDatasetSourceInterface +QgsMeshDataProvider +QgsFeaturePickerModelBase +QgsDataItemProvider +QgsSurface +QgsAbstractLayerMetadataProvider +QgsSettingsTreeNode +QgsSettingsTreeNamedListNode +QgsPolymorphicRelation +QgsFeaturePickerModel +QgsNumericFormat +QgsImageCache +QgsMapRendererJob +QgsMapRendererQImageJob +QgsMapRendererAbstractCustomPainterJob +QgsMapRendererTask +QgsVectorFileWriterTask +QgsLocatorFilter +QgsLocatorModel +QgsSQLStatement +QgsGeometryValidator +QgsAuthMethod +QgsReferencedPointXY +QgsLayerTreeNode +QgsLayerTreeLayer +QgsLayerTree +QgsGeometryCollection +QgsCircle +QgsProcessingParameterFile +QgsProcessingParameterMultipleLayers +QgsProcessingParameterRasterLayer +QgsProcessingParameterVectorLayer +QgsProcessingParameterMeshLayer +QgsProcessingParameterMapLayer +QgsProcessingParameterFeatureSource +QgsProcessingDestinationParameter +QgsProcessingParameterPointCloudLayer +QgsRenderedFeatureHandlerInterface +QgsSnappingUtils +QgsLayoutUndoObjectInterface +QgsLayoutItemAbstractMetadata +QgsLayoutMultiFrameAbstractMetadata +QgsMasterLayoutInterface +QgsLayoutItemMapGrid +QgsLayoutNodesItem +QgsLayoutMultiFrame +QgsLayoutTable +QgsLayoutItemPicture +QgsLegendModel +QgsCalloutAbstractMetadata +QgsMeshVertexCirculator +QgsSymbolLayer +QgsMarkerSymbolLayer +QgsLineSymbolLayer +QgsFillSymbolLayer +QgsMeshEditForceByLine +QgsAbstractValidityCheck +QgsDiagram +QgsDiagramRenderer +QgsAuxiliaryStorage +QgsTextBlock +QgsTextDocument +QgsSymbolLayerUtils +QgsRendererRange +QgsStyleEntityInterface +QgsStyleEntityVisitorInterface +QgsFeatureRendererGenerator +QgsSimpleMarkerSymbolLayerBase +QgsSimpleMarkerSymbolLayer +QgsFilledMarkerSymbolLayer +QgsSvgMarkerSymbolLayer +QgsRasterMarkerSymbolLayer +QgsSymbolLayerAbstractMetadata +QgsSimpleLineSymbolLayer +QgsTemplatedLineSymbolLayerBase +QgsAbstractBrushedLineSymbolLayer +QgsPointDistanceRenderer +QgsPointClusterRenderer +QgsRendererAbstractMetadata +QgsPointDisplacementRenderer +QgsSvgCache +QgsSimpleFillSymbolLayer +QgsImageFillSymbolLayer +QgsEffectPainter +QgsGlowEffect +QgsShadowEffect +QgsPaintEffectAbstractMetadata +QgsPointCloudBlock +QgsPointCloudLayerExporter +QgsPointCloudLayerExporterTask +QgsPointCloudRenderer +QgsPointCloudRendererAbstractMetadata +QgsProxyProgressTask +QgsSensorAbstractMetadata +QgsIODeviceSensor +QgsDatabaseQueryLog +QgsProfilePoint +QgsLocalizedDataPathRegistry +QgsMapBoxGlStyleAbstractSource +QgsVectorTileRenderer +QgsDatabaseSchemaModel +QgsReadWriteLocker +QgsProviderRegistry +QgsVectorLayerFeatureCounter +QgsVectorLayerExporterTask +QgsProcessingParameterType +QgsProcessingLayerPostProcessorInterface +QgsProcessingAlgorithm +QgsProcessingFeatureBasedAlgorithm +QgsProcessingAlgRunnerTask +QgsProcessingModelChildAlgorithm +QgsMapLayerLegend +QgsLayerTreeRegistryBridge +QgsAnnotationItemAbstractMetadata +QgsTemporalNavigationObject +QgsFeatureFilterModel +QgsProcessingModelComponent +QgsProcessingModelParameter +QgsProjectFileTransform +QgsLayoutAtlas +QgsAbstractGeocoderLocatorFilter +QgsReferencedRectangle diff --git a/qt-for-python/qgis/core/generate_global_file.sh b/qt-for-python/qgis/core/generate_global_file.sh new file mode 100755 index 000000000000..cf95d351030e --- /dev/null +++ b/qt-for-python/qgis/core/generate_global_file.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +SCRIPT_DIR=$(dirname $(readlink -f "$0")) + +FILE=$SCRIPT_DIR/qgis_core_global.h +echo "// Generated by the ugly script generate_global_file.sh" >> $FILE +echo "#pragma once" > $FILE + +echo "// Make \"signals:\", \"slots:\" visible as access specifiers" >> $FILE +echo "#define QT_ANNOTATE_ACCESS_SPECIFIER(a) __attribute__((annotate(#a)))" >> $FILE + +pushd $SCRIPT_DIR/../../../src/core > /dev/null + +mkdir -p $SCRIPT_DIR/typesystems + +TYPESYSTEM_FILE="$SCRIPT_DIR/typesystems/typesystem_all.xml" +echo "" >> $TYPESYSTEM_FILE +echo "" > $TYPESYSTEM_FILE +echo "" >> $TYPESYSTEM_FILE + + +for hdr in $(find . -name "*.h" | grep -v _p); +do + if [[ $(grep "SIP_NO_FILE" $hdr | wc -l) -gt 0 ]]; + then + continue + fi + + hdr_str=$(echo $hdr | sed "s/\.\///") + echo "#include <$hdr_str>" >> $FILE + + typesystem_file=$(basename "${hdr%.*}".xml) + typesystem_filepath=$SCRIPT_DIR/typesystems/$typesystem_file + + if [[ ! -f $typesystem_filepath ]] + then + echo "Generating $typesystem_file ..." + /home/julien/work/pyside-setup/build/sources/shiboken6/tests/dumpcodemodel/dumpcodemodel -- -DQT_CONCURRENT_LIB -DQT_CORE5COMPAT_LIB -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050800 -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_CAST_TO_ASCII -DQT_NO_FOREACH -DQT_POSITIONING_LIB -DQT_PRINTSUPPORT_LIB -DQT_SERIALPORT_LIB -DQT_SQL_LIB -DQT_SVG_LIB -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -DQT_XML_LIB -DTEST_DATA_DIR="/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/tests/testdata" -DWITH_COPC -DWITH_EPT -D_HAVE_PTHREAD_ -Dqgis_core_EXPORTS -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/build/src/core/qgis_core_autogen/include -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/build -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/external/poly2tri -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/providers/ept -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/providers/copc -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/providers/vpc -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/build/src/core -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/3d -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/actions -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/annotations -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/auth -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/browser -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/callouts -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/classification -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/diagram -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/dxf -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/editform -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/effects -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/elevation -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/expression -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/externalstorage -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/fieldformatter -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/geometry -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/geocoding -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/gps -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/labeling -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/layertree -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/layout -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/locator -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/maprenderer -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/mesh -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/metadata -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/network -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/numericformats -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/pal -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/plot -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/pointcloud -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/pointcloud/expression -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/processing -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/processing/models -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/proj -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/project -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/providers -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/providers/arcgis -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/providers/memory -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/providers/gdal -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/providers/ogr -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/providers/meshmemory -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/raster -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/renderer -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/scalebar -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/settings -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/sensor -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/symbology -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/textrenderer -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/validity -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/vector -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/src/core/vectortile -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/external -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/external/nlohmann -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/external/kdbush/include -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/external/nmea -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/external/rtree/include -I/home/julien/work/QGIS/.worktrees/qt-for-python-qt6/external/meshOptimizer -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtCore -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtGui -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtDBus -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtXml -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtWidgets -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtSvg -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtPrintSupport -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtNetwork -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtSql -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtConcurrent -isystem /usr/include/gdal -isystem /home/julien/work/depends/qca-2.3.5/install/include/Qca-qt6/QtCrypto -isystem /home/julien/work/depends/qtkeychain-0.13.2/install/include/qt6keychain -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtSerialPort -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/mkspecs/linux-g++ -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtCore5Compat -isystem /home/julien/work/depends/Qt/6.5.0/gcc_64/include/QtPositioning -Wall -Wextra -Wno-long-long -Wformat-security -Wno-strict-aliasing -Wnon-virtual-dtor -Wno-redundant-move -Wno-misleading-indentation -Wno-deprecated-copy -g -fPIC -fvisibility=hidden -fPIC -std=gnu++17 $hdr > $typesystem_filepath 2> /dev/null + [[ $? -ne 0 ]] && echo "Error while generating file: $typesystem_file" && exit + fi + + echo "" >> $TYPESYSTEM_FILE + +done + +#parallel --ungroup --jobs 3 /home/julien/work/pyside-setup/build/sources/shiboken6/tests/dumpcodemodel/dumpcodemodel ::: 1 2 3 4 5 6 + +echo "" >> $TYPESYSTEM_FILE + +popd > /dev/null diff --git a/qt-for-python/qgis/core/qgis_core.cpp b/qt-for-python/qgis/core/qgis_core.cpp new file mode 100644 index 000000000000..1295ffef2815 --- /dev/null +++ b/qt-for-python/qgis/core/qgis_core.cpp @@ -0,0 +1,52 @@ + +// @snippet QgsFeature-__setitem__ +QVariant cppValue = %CONVERTTOCPP[QVariant](_value); + +qDebug() << "cppValue=" << cppValue; + +bool rv = %CPPSELF->setAttribute( _i, cppValue ); + +if ( !rv ) +{ + PyErr_SetString( PyExc_KeyError, QByteArray::number( _i ) ); + return -1; +} + +return 0; +// @snippet QgsFeature-__setitem__ + +// @snippet qgsapplication-init +static void QgsApplicationConstructor(PyObject *self, PyObject *pyargv, bool GUIenabled, QgsApplicationWrapper **cptr) +{ + static int argc; + static char **argv; + PyObject *stringlist = PyTuple_GET_ITEM(pyargv, 0); + if (Shiboken::listToArgcArgv(stringlist, &argc, &argv, "PySideApp")) { + *cptr = new QgsApplicationWrapper(argc, argv, GUIenabled); + Shiboken::Object::releaseOwnership(reinterpret_cast(self)); + PySide::registerCleanupFunction(&PySide::destroyQCoreApplication); + } +} +// @snippet qgsapplication-init + +// @snippet qgsapplication +QgsApplicationConstructor(%PYSELF, args, %2, &%0); +// @snippet qgsapplication + +// @snippet QgsField-convertCompatible(QVariant&) +bool res; +QString errorMessage; + +res = %CPPSELF->convertCompatible( %1, &errorMessage ); + +if ( !res ) +{ + PyErr_SetString( PyExc_ValueError, + QString( "Value could not be converted to field type %1: %2" ).arg( QMetaType::typeName( %CPPSELF->type() ), errorMessage ).toUtf8().constData() ); + return nullptr; +} +else +{ + %PYARG_0 = %CONVERTTOPYTHON[bool](res); +} +// @snippet QgsField-convertCompatible(QVariant&) diff --git a/qt-for-python/qgis/core/qgis_core_global.h b/qt-for-python/qgis/core/qgis_core_global.h new file mode 100644 index 000000000000..58b49a00fd04 --- /dev/null +++ b/qt-for-python/qgis/core/qgis_core_global.h @@ -0,0 +1,755 @@ +#pragma once +// Make "signals:", "slots:" visible as access specifiers +#define QT_ANNOTATE_ACCESS_SPECIFIER(a) __attribute__((annotate(#a))) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include <3d/qgsabstractpointcloud3drenderer.h> +#include <3d/qgs3drendererregistry.h> +#include <3d/qgs3dsymbolregistry.h> +#include <3d/qgsabstract3drenderer.h> +#include <3d/qgsabstract3dsymbol.h> +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/qt-for-python/qgis/core/ts.patch b/qt-for-python/qgis/core/ts.patch new file mode 100644 index 000000000000..e84274e296fd --- /dev/null +++ b/qt-for-python/qgis/core/ts.patch @@ -0,0 +1,68 @@ +diff --git a/qt-for-python/qgis/core/typesystem_generated.xml b/qt-for-python/qgis/core/typesystem_generated.xml +index 2d4e0d1fa96..435758ef277 100644 +--- a/qt-for-python/qgis/core/typesystem_generated.xml ++++ b/qt-for-python/qgis/core/typesystem_generated.xml +@@ -707,7 +707,8 @@ + + + +- ++ ++ + + " ).arg( %CPPSELF->includeLower() ? QStringLiteral( "[" ) : QStringLiteral( "(" ) ) +@@ -898,16 +899,26 @@ + + + ++ ++ ++ ++ ++ + + + +- ++ + + + + + + ++ ++ ++ ++ ++ + + + +@@ -3360,6 +3349,7 @@ + + + ++ + + + +@@ -4601,14 +4601,14 @@ return 0; + { + QVector> res = %CPPSELF->identify( %1, %2, %3, %4 ); + auto var = PyList_New( res.size() ); +- %PYARG_0 = %CONVERTTOPYTHON[PyObject*](var); ++ %PYARG_0 = var; + for ( int i = 0; i < res.size(); ++i ) + { + PyObject *dict = PyDict_New(); + for ( QString key : res[i].keys() ) + { +- PyObject *keyObj = new QString( key ); +- PyObject *valObj = new QVariant( res[i][key] ); ++ PyObject *keyObj = %CONVERTTOPYTHON[QString](key); ++ PyObject *valObj = %CONVERTTOPYTHON[QVariant](res[i][key]); + PyDict_SetItem( dict, keyObj, valObj ); + } + PyList_SET_ITEM( %PYARG_0, i, dict ); diff --git a/qt-for-python/qgis/core/typesystem_generated.xml b/qt-for-python/qgis/core/typesystem_generated.xml new file mode 100644 index 000000000000..3fd7dc4c2e86 --- /dev/null +++ b/qt-for-python/qgis/core/typesystem_generated.xml @@ -0,0 +1,5382 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->asWkt() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + x() ); + } + else if ( _i == 1 ) + { + return Py_BuildValue( "d", %CPPSELF->y() ); + } + else + { + QString msg = QString( "Bad index: %1" ).arg( _i ); + PyErr_SetString( PyExc_IndexError, msg.toLatin1().constData() ); +return 0; + } +]]> + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->asWktCoordinates() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + isValid() ? QStringLiteral( "" ).arg( !%CPPSELF->authid().isEmpty() ? %CPPSELF->authid() : %CPPSELF->toWkt( QgsCoordinateReferenceSystem::WKT_PREFERRED ), + std::isfinite( %CPPSELF->coordinateEpoch() ) ? QStringLiteral( " @ %1" ).arg( %CPPSELF->coordinateEpoch() ) : QString() ) + : QStringLiteral( "" ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->message( QgsErrorMessage::Text ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->sourceCrs().isValid() ? %CPPSELF->sourceCrs().authid() : QStringLiteral( "NULL" ), + %CPPSELF->destinationCrs().isValid() ? %CPPSELF->destinationCrs().authid() : QStringLiteral( "NULL" ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + isValid() ? QStringLiteral( "" ).arg( + %CPPSELF->expression().length() > 1000 ? %CPPSELF->expression().left( 1000 ) + QStringLiteral( "..." ) + : %CPPSELF->expression() ) + : QStringLiteral( "" ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name() ).arg( %CPPSELF->typeName() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + = %CPPSELF->count() ) + { + PyErr_SetString( PyExc_KeyError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + %CPPSELF->remove( %1 ); + } +]]> + + + count(); +]]> + + + + + + = %CPPSELF->count() ) + { + PyErr_SetString( PyExc_KeyError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + auto var = new QgsField( %CPPSELF->at( %1 ) ); + %PYARG_0 = %CONVERTTOPYTHON[QgsField *](var); + } +]]> + + + = %CPPSELF->count() ) + { + PyErr_SetString( PyExc_KeyError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + auto var = new QgsField( %CPPSELF->field( %1 ) ); + %PYARG_0 = %CONVERTTOPYTHON[QgsField *](var); + } +]]> + + + indexFromName( %1 ); + if ( fieldIdx == -1 ) + { + PyErr_SetString( PyExc_KeyError, %1.toLatin1() ); + return nullptr; + } + else + { + auto var = new QgsField( %CPPSELF->field( %1 ) ); + %PYARG_0 = %CONVERTTOPYTHON[QgsField *](var); + } +]]> + + + = %CPPSELF->count() ) + { + PyErr_SetString( PyExc_KeyError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + auto var = %CPPSELF->fieldOrigin( %1 ); + %PYARG_0 = %CONVERTTOPYTHON[QgsFields::FieldOrigin](var); + } +]]> + + + = %CPPSELF->count() ) + { + PyErr_SetString( PyExc_KeyError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + auto var = %CPPSELF->fieldOriginIndex( %1 ); + %PYARG_0 = %CONVERTTOPYTHON[int](var); + } +]]> + + + = %CPPSELF->count() ) + { + PyErr_SetString( PyExc_KeyError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + auto var = new QIcon( %CPPSELF->iconForField( %1 ) ); + %PYARG_0 = %CONVERTTOPYTHON[QIcon *](var); + } +]]> + + + + + + + + + + + + + + + + + + + = 0 && %1 < %CPPSELF->attributes().count() ) + %CPPSELF->deleteAttribute( %1 ); + else + { + PyErr_SetString( PyExc_KeyError, QByteArray::number( %1 ) ); + return nullptr; + } +]]> + + + fieldNameIndex( %1 ); + if ( fieldIdx == -1 ) + { + PyErr_SetString( PyExc_KeyError, %1.toLatin1() ); + return nullptr; + } + else + %CPPSELF->deleteAttribute( fieldIdx ); +]]> + + + + + + setAttribute( %1, QVariant( QMetaType( QMetaType::Int ) ) ); + } + else + { + rv = %CPPSELF->setAttribute( %1, %2 ); + } + + if ( !rv ) + { + PyErr_SetString( PyExc_KeyError, QByteArray::number( %1 ) ); + return nullptr; + } + + auto var = rv; + %PYARG_0 = %CONVERTTOPYTHON[bool](var); +]]> + + + = 0 && %1 < %CPPSELF->attributes().count() ) + %CPPSELF->deleteAttribute( %1 ); + else + { + PyErr_SetString( PyExc_KeyError, QByteArray::number( %1 ) ); + return nullptr; + } +]]> + + + fieldNameIndex( %1 ); + if ( fieldIdx == -1 ) + { + PyErr_SetString( PyExc_KeyError, %1.toLatin1() ); + return nullptr; + } + else + { + if ( !%2.isValid() ) + { + %CPPSELF->setAttribute( %1, QVariant( QMetaType( QMetaType::Int ) ) ); + } + else + { + %CPPSELF->setAttribute( fieldIdx, %2 ); + } + } +]]> + + + fieldNameIndex( %1 ); + if ( fieldIdx == -1 ) + { + PyErr_SetString( PyExc_KeyError, %1.toLatin1() ); + return nullptr; + Py_RETURN_FALSE; + } + else + { + %CPPSELF->deleteAttribute( fieldIdx ); + Py_RETURN_TRUE; + } +]]> + + + = %CPPSELF->attributes().count() ) + { + PyErr_SetString( PyExc_KeyError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + auto var = %CPPSELF->isUnsetValue( %1 ); + %PYARG_0 = %CONVERTTOPYTHON[bool](var); + } + } +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->asWkt() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->part ).arg( %CPPSELF->ring ).arg( %CPPSELF->vertex ).arg( qgsEnumValueToKey( %CPPSELF->type ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().data() ); +]]> + + + + + + + + + + " ).arg( %CPPSELF->what() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().data() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + isNull() ) + str = QStringLiteral( "" ); + else + { + QString wkt = %CPPSELF->asWkt(); + if ( wkt.length() > 1000 ) + wkt = wkt.left( 1000 ) + QStringLiteral( "..." ); + str = QStringLiteral( "" ).arg( wkt ); + } + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->expression() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ) + .arg( %CPPSELF->xMinimum() ) + .arg( %CPPSELF->yMinimum() ) + .arg( %CPPSELF->zMinimum() ) + .arg( %CPPSELF->xMaximum() ) + .arg( %CPPSELF->yMaximum() ) + .arg( %CPPSELF->zMaximum() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + " ).arg( %CPPSELF->includeLower() ? QStringLiteral( "[" ) : QStringLiteral( "(" ) ) + .arg( %CPPSELF->lower() ) + .arg( %CPPSELF->upper() ) + .arg( %CPPSELF->includeUpper() ? QStringLiteral( "]" ) : QStringLiteral( ")" ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + " ).arg( %CPPSELF->includeLower() ? QStringLiteral( "[" ) : QStringLiteral( "(" ) ) + .arg( %CPPSELF->lower() ) + .arg( %CPPSELF->upper() ) + .arg( %CPPSELF->includeUpper() ? QStringLiteral( "]" ) : QStringLiteral( ")" ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->message() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + " ).arg( %CPPSELF->uri( false ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->dataProvider() ? %CPPSELF->dataProvider()->name() : QStringLiteral( "Invalid" ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + propertyType() ) + { + case QgsProperty::StaticProperty: + typeString = QStringLiteral( "static" ); + definitionString = %CPPSELF->staticValue().toString(); + break; + + case QgsProperty::FieldBasedProperty: + typeString = QStringLiteral( "field" ); + definitionString = %CPPSELF->field(); + break; + + case QgsProperty::ExpressionBasedProperty: + typeString = QStringLiteral( "expression" ); + definitionString = %CPPSELF->expressionString(); + break; + + case QgsProperty::InvalidProperty: + typeString = QStringLiteral( "invalid" ); + break; + } + + QString str = QStringLiteral( "" ).arg( !%CPPSELF->isActive() && %CPPSELF->propertyType() != QgsProperty::InvalidProperty ? QStringLiteral( "INACTIVE " ) : QString(), + typeString, + definitionString.isEmpty() ? QString() : QStringLiteral( " (%1)" ).arg( definitionString ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ::quiet_NaN(); + } + else + { + minimum = PyFloat_AsDouble( %3 ); + } + + if ( %4 == Py_None ) + { + maximum = std::numeric_limits::quiet_NaN(); + } + else + { + maximum = PyFloat_AsDouble( %4 ); + } + + auto var = %CPPSELF->hasHistogram( %1, %2, minimum, maximum, %5, %6, %7 ); + %PYARG_0 = %CONVERTTOPYTHON[bool](var); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + symbolLayerCount(); +]]> + + + + + + symbolLayerCount(); + if ( %1 >= 0 && %1 < count ) + %CPPSELF->deleteSymbolLayer( %1 ); + else if ( %1 < 0 && %1 >= -count ) + %CPPSELF->deleteSymbolLayer( count + %1 ); + else + { + PyErr_SetString( PyExc_IndexError, QByteArray::number( %1 ) ); + return nullptr; + } +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->dataProvider() ? %CPPSELF->dataProvider()->name() : QStringLiteral( "Invalid" ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + featureCount(); +]]> + + + + + + + + + + + + + + + + + + + + + + + asWkt(); + if ( wkt.length() > 1000 ) + wkt = wkt.left( 1000 ) + QStringLiteral( "..." ); + QString str = QStringLiteral( "" ).arg( wkt ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + numPoints(); + if ( %1 < -count || %1 >= count ) + { + PyErr_SetString( PyExc_IndexError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + if ( %1 >= 0 ) + %CPPSELF->setXAt( %1, %2 ); + else + %CPPSELF->setXAt( count + %1, %2 ); + } +]]> + + + numPoints(); + if ( %1 < -count || %1 >= count ) + { + PyErr_SetString( PyExc_IndexError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + if ( %1 >= 0 ) + %CPPSELF->setYAt( %1, %2 ); + else + %CPPSELF->setYAt( count + %1, %2 ); + } +]]> + + + numPoints(); + if ( %1 < -count || %1 >= count ) + { + PyErr_SetString( PyExc_IndexError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + if ( %1 >= 0 ) + %CPPSELF->setZAt( %1, %2 ); + else + %CPPSELF->setZAt( count + %1, %2 ); + } +]]> + + + numPoints(); + if ( %1 < -count || %1 >= count ) + { + PyErr_SetString( PyExc_IndexError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + if ( %1 >= 0 ) + %CPPSELF->setMAt( %1, %2 ); + else + %CPPSELF->setMAt( count + %1, %2 ); + } +]]> + + + asWkt(); + if ( wkt.length() > 1000 ) + wkt = wkt.left( 1000 ) + QStringLiteral( "..." ); + QString str = QStringLiteral( "" ).arg( wkt ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + numPoints(); + if ( %1 >= 0 && %1 < count ) + %CPPSELF->deleteVertex( QgsVertexId( -1, -1, %1 ) ); + else if ( %1 < 0 && %1 >= -count ) + %CPPSELF->deleteVertex( QgsVertexId( -1, -1, count + %1 ) ); + else + { + PyErr_SetString( PyExc_IndexError, QByteArray::number( %1 ) ); + return nullptr; + } +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + name().isEmpty() ) + str = QStringLiteral( "" ).arg( %CPPSELF->name(), %CPPSELF->rule() ); + else + str = QStringLiteral( "" ).arg( %CPPSELF->rule() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + size(); +]]> + + + = %CPPSELF->size() ) + { + PyErr_SetString( PyExc_IndexError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + return PyLong_FromLong( %CPPSELF->columnWidth( %1 ) ); + } + } +]]> + + + = %CPPSELF->size() ) + { + PyErr_SetString( PyExc_IndexError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + %CPPSELF->setColumnWidth( %1, %2 ); + } +]]> + + + = %CPPSELF->size() ) + { + PyErr_SetString( PyExc_IndexError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + return PyBool_FromLong( %CPPSELF->columnHidden( %1 ) ); + } + } +]]> + + + = %CPPSELF->size() ) + { + PyErr_SetString( PyExc_IndexError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + %CPPSELF->setColumnHidden( %1, %2 ); + } +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->dataProvider() ? %CPPSELF->dataProvider()->name() : QStringLiteral( "Invalid" ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + " ).arg( %CPPSELF->toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->key() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->providerKey, %CPPSELF->uri ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->path() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->path() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->path() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + " ).arg( %CPPSELF->dirPath(), %CPPSELF->path() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->path() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->path() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + = %CPPSELF->numInteriorRings() ) + { + PyErr_SetString( PyExc_IndexError, QByteArray::number( %1 ) ); + return nullptr; + } + else + { + return PyBool_FromLong( %CPPSELF->removeInteriorRing( %1 ) ); + } +]]> + + + asWkt(); + if ( wkt.length() > 1000 ) + wkt = wkt.left( 1000 ) + QStringLiteral( "..." ); + QString str = QStringLiteral( "" ).arg( wkt ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + asWkt(); + if ( wkt.length() > 1000 ) + wkt = wkt.left( 1000 ) + QStringLiteral( "..." ); + QString str = QStringLiteral( "" ).arg( wkt ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + result; + Py_BEGIN_ALLOW_THREADS + result = %CPPSELF->nextRow( ); + Py_END_ALLOW_THREADS + if ( ! result.isEmpty() ) + { + + auto var = new QList( result ); + %PYARG_0 = %CONVERTTOPYTHON[QList *](var); + } + else + { + PyErr_SetString( PyExc_StopIteration, "" ); + } +]]> + + + + + + + + + + " ).arg( %CPPSELF->tableName() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + " ).arg( %CPPSELF->path() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->path() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + count(); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->fileName(), + %CPPSELF == QgsProject::instance() ? QStringLiteral( " (singleton instance)" ) : QString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + referencedLayer().source.isEmpty() ) + leftIdentifier = %CPPSELF->referencedLayer().source; + + QString rightIdentifier; + if ( !%CPPSELF->referencingLayer().source.isEmpty() ) + rightIdentifier = %CPPSELF->referencingLayer().source; + + QString str; + if ( leftIdentifier.isEmpty() && rightIdentifier.isEmpty() ) + str = QStringLiteral( "" ).arg( %CPPSELF->id() ); + else + str = QStringLiteral( " %3>" ).arg( %CPPSELF->id(), leftIdentifier, rightIdentifier ); + + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->path() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->path() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->path() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + " ).arg( %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + code().isEmpty() ) + id = QStringLiteral( "%1 (%2:%3)" ).arg( %CPPSELF->name(), %CPPSELF->authority(), %CPPSELF->code() ); + else + id = %CPPSELF->name(); + QString str = QStringLiteral( "" ).arg( id ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + isValid() ) + { + str = QStringLiteral( "" ); + } + else + { + QString id; + if ( !%CPPSELF->code().isEmpty() ) + id = QStringLiteral( "%1 (%2:%3)" ).arg( %CPPSELF->name(), %CPPSELF->authority(), %CPPSELF->code() ); + else + id = %CPPSELF->name(); + str = QStringLiteral( "" ).arg( id ); + } + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + isValid() ) + { + str = QStringLiteral( "" ); + } + else + { + QString id; + if ( !%CPPSELF->authority().isEmpty() ) + id = QStringLiteral( "%1 (%2)" ).arg( %CPPSELF->name(), %CPPSELF->authority() ); + else + id = %CPPSELF->name(); + str = QStringLiteral( "" ).arg( id ); + } + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + isValid() ) + { + str = QStringLiteral( "" ); + } + else + { + str = QStringLiteral( "" ); + } + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + isValid() ) + { + str = QStringLiteral( "" ); + } + else + { + str = QStringLiteral( "" ).arg( %CPPSELF->id() ); + } + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + symbolLayerIndexPath() ) + { + pathString.append( QString::number( path ) ); + } + QString str = QStringLiteral( "" ).arg( %CPPSELF->symbolKey(), pathString.join( ',' ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + symbolLayerId().symbolLayerIndexPath() ) + { + pathString.append( QString::number( path ) ); + } + QString str = QStringLiteral( "" ).arg( %CPPSELF->layerId(), %CPPSELF->symbolLayerIdV2() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->text() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + " ).arg( %CPPSELF->text() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + fnIndex()] ) + { + function = fd->name(); + } + else + { + function = QString::number( %CPPSELF->fnIndex() ); + } + + QString str = QStringLiteral( "" ).arg( function ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + " ).arg( %CPPSELF->valueAsString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + " ).arg( %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->asWkt(), %CPPSELF->crs().authid() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + " ).arg( %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + asWkt(); + if ( wkt.length() > 1000 ) + wkt = wkt.left( 1000 ) + QStringLiteral( "..." ); + QString str = QStringLiteral( "" ).arg( wkt ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + " ).arg( %CPPSELF->toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + asWkt(); + if ( wkt.length() > 1000 ) + wkt = wkt.left( 1000 ) + QStringLiteral( "..." ); + QString str = QStringLiteral( "" ).arg( wkt ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + asWkt(); + if ( wkt.length() > 1000 ) + wkt = wkt.left( 1000 ) + QStringLiteral( "..." ); + QString str = QStringLiteral( "" ).arg( wkt ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + asWkt(); + if ( wkt.length() > 1000 ) + wkt = wkt.left( 1000 ) + QStringLiteral( "..." ); + QString str = QStringLiteral( "" ).arg( wkt ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + asWkt(); + if ( wkt.length() > 1000 ) + wkt = wkt.left( 1000 ) + QStringLiteral( "..." ); + QString str = QStringLiteral( "" ).arg( wkt ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->label() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->extent().asWktCoordinates(), %CPPSELF->extent().crs().authid() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->width() ).arg( %CPPSELF->height() ).arg( QgsUnitTypes::toAbbreviatedString( %CPPSELF->units() ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->x() ).arg( %CPPSELF->y() ).arg( QgsUnitTypes::toAbbreviatedString( %CPPSELF->units() ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + " ).arg( %CPPSELF->length() ).arg( QgsUnitTypes::toAbbreviatedString( %CPPSELF->units() ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->data( Qt::DisplayRole ).toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + data( QgsLayerTreeModelLegendNode::RuleKeyRole ).toString(), + %CPPSELF->data( Qt::DisplayRole ).toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->data( Qt::DisplayRole ).toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->data( Qt::DisplayRole ).toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->data( Qt::DisplayRole ).toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->data( Qt::DisplayRole ).toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->data( Qt::DisplayRole ).toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + " ).arg( %CPPSELF->data( Qt::DisplayRole ).toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + " ).arg( %CPPSELF->content().toString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + heading() != %CPPSELF->attribute() && !%CPPSELF->heading().isEmpty() ) + str = QStringLiteral( "" ).arg( %CPPSELF->attribute(), %CPPSELF->heading() ); + else + str = QStringLiteral( "" ).arg( %CPPSELF->attribute() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->dataProvider() ? %CPPSELF->dataProvider()->name() : QStringLiteral( "Invalid" ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + count(); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + value().isValid() + ? QStringLiteral( "" ) + : %CPPSELF->label().isEmpty() + ? QStringLiteral( "" ).arg( %CPPSELF->value().toString() ) + : QStringLiteral( "" ).arg( %CPPSELF->value().toString(), %CPPSELF->label() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name() ).arg( %CPPSELF->displayType() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + > res = %CPPSELF->identify( %1, %2, %3, %4 ); + auto var = PyList_New( res.size() ); + %PYARG_0 = var; + for ( int i = 0; i < res.size(); ++i ) + { + PyObject *dict = PyDict_New(); + for ( QString key : res[i].keys() ) + { + PyObject *keyObj = %CONVERTTOPYTHON[QString](key); + PyObject *valObj = %CONVERTTOPYTHON[QVariant](res[i][key]); + PyDict_SetItem( dict, keyObj, valObj ); + } + PyList_SET_ITEM( %PYARG_0, i, dict ); + } + } +]]> + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->dataProvider() ? %CPPSELF->dataProvider()->name() : QStringLiteral( "Invalid" ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + defaultValueClause().isEmpty() ) + str = QStringLiteral( "" ).arg( %CPPSELF->defaultValueClause() ); + else + str = QStringLiteral( "" ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->column() ).arg( %CPPSELF->row() ).arg( %CPPSELF->zoomLevel() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->providerKey(), %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + " ).arg( %CPPSELF->type(), %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->code().toString(), %CPPSELF->value() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + " ).arg( %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + " ).arg( %CPPSELF->name(), + %CPPSELF->minimumIsInclusive() ? QStringLiteral( "[" ) : QStringLiteral( "(" ), + %CPPSELF->minimum().toString(), + %CPPSELF->maximum().toString(), + %CPPSELF->maximumIsInclusive() ? QStringLiteral( "]" ) : QStringLiteral( ")" ) ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + " ).arg( %CPPSELF->name(), %CPPSELF->glob() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + featureCount(); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + labelText; + QString str = QStringLiteral( "" ).arg( text, %CPPSELF->isUnplaced ? QStringLiteral( " (unplaced)" ) : QString() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->id().vertex ) + .arg( qgsEnumValueToKey( %CPPSELF->type() ) ) + .arg( %CPPSELF->point().x() ) + .arg( %CPPSELF->point().y() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + " ).arg( %CPPSELF->layerId(), %CPPSELF->itemId() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + " ).arg( %CPPSELF->name() ); + %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qt-for-python/qgis/core/typesystem_qgis_core.xml b/qt-for-python/qgis/core/typesystem_qgis_core.xml deleted file mode 100644 index 34947a3233fb..000000000000 --- a/qt-for-python/qgis/core/typesystem_qgis_core.xml +++ /dev/null @@ -1,399 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - -= len) - { - PyErr_SetString(PyExc_IndexError, "index out of bounds"); - return 0; - } - - // Handle negative indices (e.g. if list has 3 items, [-1] should equal to [2]) - const int idx = ( ( _i % len ) + len ) % len; - - PyObject *pyResult = Shiboken::Conversions::copyToPython(reinterpret_cast(SbkcoreTypes[SBK_QGSFIELD_IDX]), &%CPPSELF.operator[](idx)); - if (PyErr_Occurred() || !pyResult) - { - Py_XDECREF(pyResult); - } - - return pyResult; - } - else if ( ( pythonToCpp = Shiboken::Conversions::isPythonToCppConvertible( SbkPySide2_QtCoreTypeConverters[SBK_QSTRING_IDX], ( _key ) ) ) ) - { - ::QString keyName; - pythonToCpp(_key, &keyName); - - const int fieldIdx = cppSelf->indexFromName( keyName ); - if ( fieldIdx == -1 ) - { - PyErr_SetString( PyExc_KeyError, keyName.toLatin1() ); - return nullptr; - } - - PyObject *pyResult = Shiboken::Conversions::copyToPython( reinterpret_cast( SbkcoreTypes[SBK_QGSFIELD_IDX] ), &cppSelf->operator[]( fieldIdx ) ); - if ( PyErr_Occurred() || !pyResult ) - { - Py_XDECREF(pyResult); - } - - return pyResult; - } -#if 0 // NICE TO HAVE TODO - else - { - PyObject* keyRepr = PyObject_Repr( _key ); - const char* s = PyUnicode_AsUTF8( keyRepr ); - PyErr_SetString( PyExc_KeyError, s ); - Py_XDECREF( keyRepr ); - } -#endif -]]> - - - - - -= cppSelf->count() ) - { - PyErr_SetString( PyExc_KeyError, QByteArray::number( cppArg0 ) ); - return {}; - } -]]> - - - - - -= cppSelf->count() ) - { - PyErr_SetString( PyExc_KeyError, QByteArray::number( cppArg0 ) ); - return {}; - } -]]> - - - - - -= cppSelf->count() ) - { - PyErr_SetString( PyExc_KeyError, QByteArray::number( cppArg0 ) ); - return {}; - } -]]> - - - - - -= cppSelf->count() ) - { - PyErr_SetString( PyExc_KeyError, QByteArray::number( cppArg0 ) ); - return {}; - } -]]> - - - - - -= cppSelf->count() ) - { - PyErr_SetString( PyExc_KeyError, QByteArray::number( cppArg0 ) ); - return {}; - } -]]> - - - - - - -= cppSelf->count() ) - { - PyErr_SetString( PyExc_KeyError, QByteArray::number( cppArg0 ) ); - return {}; - } -]]> - - - - - -indexFromName( cppArg0 ); - if ( fieldIdx == -1 ) - { - PyErr_SetString( PyExc_KeyError, cppArg0.toUtf8() ); - return {}; - } -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -convertCompatible( %1, &errorMessage ); - } - catch ( ... ) - { - Py_BLOCK_THREADS - PyErr_SetString( PyExc_RuntimeError, "Unknown error occurred" ); - return nullptr; - } - - %END_ALLOW_THREADS - - if ( !isSuccess ) - { - PyErr_SetString( PyExc_ValueError, - ( QLatin1String( "Value could not be converted to field type " ) + QMetaType::typeName( cppSelf->type() ) + QLatin1String( ": " ) + errorMessage ).toUtf8().constData() ); - return nullptr; - } - else - { - return Shiboken::Conversions::copyToPython(SbkPySide2_QtCoreTypeConverters[SBK_QVARIANT_IDX], &%1); - } -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -isNull() ) - str = QStringLiteral( "" ); - else - { - QString wkt = %CPPSELF->asWkt(); - if ( wkt.length() > 1000 ) - wkt = wkt.left( 1000 ) + QStringLiteral( "..." ); - str = QStringLiteral( "" ).arg( wkt ); - } - %PYARG_0 = PyUnicode_FromString( str.toUtf8().constData() ); -]]> - - - - - - diff --git a/qt-for-python/qgis/core/typesystem_qgis_core.xml.in b/qt-for-python/qgis/core/typesystem_qgis_core.xml.in index eb9960a67cf7..a45f2b9b4802 100644 --- a/qt-for-python/qgis/core/typesystem_qgis_core.xml.in +++ b/qt-for-python/qgis/core/typesystem_qgis_core.xml.in @@ -8,7 +8,12 @@ typesystems --> + + + + + - - + + + + -@TYPESYSTEM_CONTENT@ + - + - - - - - - - +