diff --git a/python/core/auto_additions/qgis.py b/python/core/auto_additions/qgis.py index 78579cd3b2d..bd59a6c2c40 100644 --- a/python/core/auto_additions/qgis.py +++ b/python/core/auto_additions/qgis.py @@ -137,6 +137,7 @@ QgsSymbol.DynamicRotation.__doc__ = "Rotation of symbol may be changed during re Qgis.SymbolRenderHint.__doc__ = 'Flags controlling behavior of symbols during rendering\n\n.. versionadded:: 3.20\n\n' + '* ``DynamicRotation``: ' + Qgis.SymbolRenderHint.DynamicRotation.__doc__ # -- Qgis.SymbolRenderHint.baseClass = Qgis +QgsSymbol.RenderHints = Qgis.SymbolRenderHints # monkey patching scoped based enum Qgis.SymbolFlag.RendererShouldUseSymbolLevels.__doc__ = "If present, indicates that a QgsFeatureRenderer using the symbol should use symbol levels for best results" Qgis.SymbolFlag.__doc__ = 'Flags controlling behavior of symbols\n\n.. versionadded:: 3.20\n\n' + '* ``RendererShouldUseSymbolLevels``: ' + Qgis.SymbolFlag.RendererShouldUseSymbolLevels.__doc__ @@ -150,6 +151,7 @@ QgsSymbol.FlagIncludeCrosshairsForMarkerSymbols.__doc__ = "Include a crosshairs Qgis.SymbolPreviewFlag.__doc__ = 'Flags for controlling how symbol preview images are generated.\n\n.. versionadded:: 3.20\n\n' + '* ``FlagIncludeCrosshairsForMarkerSymbols``: ' + Qgis.SymbolPreviewFlag.FlagIncludeCrosshairsForMarkerSymbols.__doc__ # -- Qgis.SymbolPreviewFlag.baseClass = Qgis +QgsSymbol.SymbolPreviewFlags = Qgis.SymbolPreviewFlags # monkey patching scoped based enum Qgis.SymbolLayerFlag.DisableFeatureClipping.__doc__ = "If present, indicates that features should never be clipped to the map extent during rendering" Qgis.SymbolLayerFlag.__doc__ = 'Flags controlling behavior of symbol layers\n\n.. versionadded:: 3.22\n\n' + '* ``DisableFeatureClipping``: ' + Qgis.SymbolLayerFlag.DisableFeatureClipping.__doc__ @@ -230,6 +232,7 @@ QgsDataItem.ItemRepresentsFile.__doc__ = "Item's path() directly represents a fi Qgis.BrowserItemCapability.__doc__ = 'Browser item capabilities.\n\n.. versionadded:: 3.20\n\n' + '* ``NoCapabilities``: ' + Qgis.BrowserItemCapability.NoCapabilities.__doc__ + '\n' + '* ``SetCrs``: ' + Qgis.BrowserItemCapability.SetCrs.__doc__ + '\n' + '* ``Fertile``: ' + Qgis.BrowserItemCapability.Fertile.__doc__ + '\n' + '* ``Fast``: ' + Qgis.BrowserItemCapability.Fast.__doc__ + '\n' + '* ``Collapse``: ' + Qgis.BrowserItemCapability.Collapse.__doc__ + '\n' + '* ``Rename``: ' + Qgis.BrowserItemCapability.Rename.__doc__ + '\n' + '* ``Delete``: ' + Qgis.BrowserItemCapability.Delete.__doc__ + '\n' + '* ``ItemRepresentsFile``: ' + Qgis.BrowserItemCapability.ItemRepresentsFile.__doc__ # -- Qgis.BrowserItemCapability.baseClass = Qgis +QgsDataItem.Capabilities = Qgis.BrowserItemCapabilities QgsLayerItem.LayerType = Qgis.BrowserLayerType # monkey patching scoped based enum QgsLayerItem.NoType = Qgis.BrowserLayerType.NoType @@ -593,6 +596,7 @@ QgsGeometry.FlagAllowSelfTouchingHoles.is_monkey_patched = True QgsGeometry.FlagAllowSelfTouchingHoles.__doc__ = "Indicates that self-touching holes are permitted. OGC validity states that self-touching holes are NOT permitted, whilst other vendor validity checks (e.g. ESRI) permit self-touching holes." Qgis.GeometryValidityFlag.__doc__ = 'Geometry validity check flags.\n\n.. versionadded:: 3.22\n\n' + '* ``FlagAllowSelfTouchingHoles``: ' + Qgis.GeometryValidityFlag.AllowSelfTouchingHoles.__doc__ # -- +QgsGeometry.ValidityFlags = Qgis.GeometryValidityFlags Qgis.GeometryValidityFlag.baseClass = Qgis QgsGeometry.ValidationMethod = Qgis.GeometryValidationEngine # monkey patching scoped based enum @@ -818,6 +822,7 @@ QgsMapSettings.Render3DMap.is_monkey_patched = True QgsMapSettings.Render3DMap.__doc__ = "Render is for a 3D map" Qgis.MapSettingsFlag.__doc__ = 'Flags which adjust the way maps are rendered.\n\n.. versionadded:: 3.22\n\n' + '* ``Antialiasing``: ' + Qgis.MapSettingsFlag.Antialiasing.__doc__ + '\n' + '* ``DrawEditingInfo``: ' + Qgis.MapSettingsFlag.DrawEditingInfo.__doc__ + '\n' + '* ``ForceVectorOutput``: ' + Qgis.MapSettingsFlag.ForceVectorOutput.__doc__ + '\n' + '* ``UseAdvancedEffects``: ' + Qgis.MapSettingsFlag.UseAdvancedEffects.__doc__ + '\n' + '* ``DrawLabeling``: ' + Qgis.MapSettingsFlag.DrawLabeling.__doc__ + '\n' + '* ``UseRenderingOptimization``: ' + Qgis.MapSettingsFlag.UseRenderingOptimization.__doc__ + '\n' + '* ``DrawSelection``: ' + Qgis.MapSettingsFlag.DrawSelection.__doc__ + '\n' + '* ``DrawSymbolBounds``: ' + Qgis.MapSettingsFlag.DrawSymbolBounds.__doc__ + '\n' + '* ``RenderMapTile``: ' + Qgis.MapSettingsFlag.RenderMapTile.__doc__ + '\n' + '* ``RenderPartialOutput``: ' + Qgis.MapSettingsFlag.RenderPartialOutput.__doc__ + '\n' + '* ``RenderPreviewJob``: ' + Qgis.MapSettingsFlag.RenderPreviewJob.__doc__ + '\n' + '* ``RenderBlocking``: ' + Qgis.MapSettingsFlag.RenderBlocking.__doc__ + '\n' + '* ``LosslessImageRendering``: ' + Qgis.MapSettingsFlag.LosslessImageRendering.__doc__ + '\n' + '* ``Render3DMap``: ' + Qgis.MapSettingsFlag.Render3DMap.__doc__ # -- +QgsMapSettings.Flags = Qgis.MapSettingsFlags Qgis.MapSettingsFlag.baseClass = Qgis QgsRenderContext.Flag = Qgis.RenderContextFlag # monkey patching scoped based enum @@ -871,6 +876,7 @@ QgsRenderContext.ApplyClipAfterReprojection.is_monkey_patched = True QgsRenderContext.ApplyClipAfterReprojection.__doc__ = "Feature geometry clipping to mapExtent() must be performed after the geometries are transformed using coordinateTransform(). Usually feature geometry clipping occurs using the extent() in the layer's CRS prior to geometry transformation, but in some cases when extent() could not be accurately calculated it is necessary to clip geometries to mapExtent() AFTER transforming them using coordinateTransform()." Qgis.RenderContextFlag.__doc__ = 'Flags which affect rendering operations.\n\n.. versionadded:: 3.22\n\n' + '* ``DrawEditingInfo``: ' + Qgis.RenderContextFlag.DrawEditingInfo.__doc__ + '\n' + '* ``ForceVectorOutput``: ' + Qgis.RenderContextFlag.ForceVectorOutput.__doc__ + '\n' + '* ``UseAdvancedEffects``: ' + Qgis.RenderContextFlag.UseAdvancedEffects.__doc__ + '\n' + '* ``UseRenderingOptimization``: ' + Qgis.RenderContextFlag.UseRenderingOptimization.__doc__ + '\n' + '* ``DrawSelection``: ' + Qgis.RenderContextFlag.DrawSelection.__doc__ + '\n' + '* ``DrawSymbolBounds``: ' + Qgis.RenderContextFlag.DrawSymbolBounds.__doc__ + '\n' + '* ``RenderMapTile``: ' + Qgis.RenderContextFlag.RenderMapTile.__doc__ + '\n' + '* ``Antialiasing``: ' + Qgis.RenderContextFlag.Antialiasing.__doc__ + '\n' + '* ``RenderPartialOutput``: ' + Qgis.RenderContextFlag.RenderPartialOutput.__doc__ + '\n' + '* ``RenderPreviewJob``: ' + Qgis.RenderContextFlag.RenderPreviewJob.__doc__ + '\n' + '* ``RenderBlocking``: ' + Qgis.RenderContextFlag.RenderBlocking.__doc__ + '\n' + '* ``RenderSymbolPreview``: ' + Qgis.RenderContextFlag.RenderSymbolPreview.__doc__ + '\n' + '* ``LosslessImageRendering``: ' + Qgis.RenderContextFlag.LosslessImageRendering.__doc__ + '\n' + '* ``ApplyScalingWorkaroundForTextRendering``: ' + Qgis.RenderContextFlag.ApplyScalingWorkaroundForTextRendering.__doc__ + '\n' + '* ``Render3DMap``: ' + Qgis.RenderContextFlag.Render3DMap.__doc__ + '\n' + '* ``ApplyClipAfterReprojection``: ' + Qgis.RenderContextFlag.ApplyClipAfterReprojection.__doc__ # -- +QgsRenderContext.Flags = Qgis.RenderContextFlags Qgis.RenderContextFlag.baseClass = Qgis QgsRenderContext.TextRenderFormat = Qgis.TextRenderFormat # monkey patching scoped based enum diff --git a/python/core/auto_generated/qgis.sip.in b/python/core/auto_generated/qgis.sip.in index 31023d7b3a9..297dbc18111 100644 --- a/python/core/auto_generated/qgis.sip.in +++ b/python/core/auto_generated/qgis.sip.in @@ -139,6 +139,7 @@ The development version typedef QFlags SymbolRenderHints; + enum class SymbolFlag { RendererShouldUseSymbolLevels, diff --git a/scripts/sipify.pl b/scripts/sipify.pl index bc8cc884a3e..02adb3a0fa2 100755 --- a/scripts/sipify.pl +++ b/scripts/sipify.pl @@ -1055,6 +1055,10 @@ while ($LINE_IDX < $LINE_COUNT){ # Enum declaration # For scoped and type based enum, the type has to be removed + if ( $LINE =~ m/^\s*Q_DECLARE_FLAGS\s*\(\s*(?\w+)\s*,\s*(?\w+)\s*\)\s*SIP_MONKEYPATCH_FLAGS_UNNEST\s*\(\s*(?\w+)\s*,\s*(?\w+)\s*\)\s*$/ ){ + push @OUTPUT_PYTHON, "$+{emkb}.$+{emkf} = $ACTUAL_CLASS.$+{flags_name}\n"; + $LINE =~ s/\s*SIP_MONKEYPATCH_FLAGS_UNNEST\(.*?\)//; + } if ( $LINE =~ m/^(\s*enum(\s+Q_DECL_DEPRECATED)?\s+(?class\s+)?(?\w+))(:?\s+SIP_.*)?(\s*:\s*\w+)?(?.*)$/ ){ my $enum_decl = $1; $enum_decl =~ s/\s*\bQ_DECL_DEPRECATED\b//; diff --git a/src/core/qgis.h b/src/core/qgis.h index 299591329f8..616fefe70ea 100644 --- a/src/core/qgis.h +++ b/src/core/qgis.h @@ -196,7 +196,8 @@ class CORE_EXPORT Qgis DynamicRotation = 2, //!< Rotation of symbol may be changed during rendering and symbol should not be cached }; Q_ENUM( SymbolRenderHint ) - Q_DECLARE_FLAGS( SymbolRenderHints, SymbolRenderHint ) + Q_DECLARE_FLAGS( SymbolRenderHints, SymbolRenderHint ) SIP_MONKEYPATCH_FLAGS_UNNEST( QgsSymbol, RenderHints ) + /** * \brief Flags controlling behavior of symbols @@ -220,7 +221,7 @@ class CORE_EXPORT Qgis FlagIncludeCrosshairsForMarkerSymbols = 1 << 0, //!< Include a crosshairs reference image in the background of marker symbol previews }; Q_ENUM( SymbolPreviewFlag ) - Q_DECLARE_FLAGS( SymbolPreviewFlags, SymbolPreviewFlag ) + Q_DECLARE_FLAGS( SymbolPreviewFlags, SymbolPreviewFlag ) SIP_MONKEYPATCH_FLAGS_UNNEST( QgsSymbol, SymbolPreviewFlags ) /** * \brief Flags controlling behavior of symbol layers @@ -283,7 +284,7 @@ class CORE_EXPORT Qgis ItemRepresentsFile = 1 << 6, //!< Item's path() directly represents a file on disk (since QGIS 3.22) }; Q_ENUM( BrowserItemCapability ) - Q_DECLARE_FLAGS( BrowserItemCapabilities, BrowserItemCapability ) + Q_DECLARE_FLAGS( BrowserItemCapabilities, BrowserItemCapability ) SIP_MONKEYPATCH_FLAGS_UNNEST( QgsDataItem, Capabilities ) /** * Browser item layer types @@ -664,7 +665,7 @@ class CORE_EXPORT Qgis { AllowSelfTouchingHoles SIP_MONKEYPATCH_COMPAT_NAME( FlagAllowSelfTouchingHoles ) = 1 << 0, //!< Indicates that self-touching holes are permitted. OGC validity states that self-touching holes are NOT permitted, whilst other vendor validity checks (e.g. ESRI) permit self-touching holes. }; - Q_DECLARE_FLAGS( GeometryValidityFlags, GeometryValidityFlag ) + Q_DECLARE_FLAGS( GeometryValidityFlags, GeometryValidityFlag ) SIP_MONKEYPATCH_FLAGS_UNNEST( QgsGeometry, ValidityFlags ) Q_ENUM( GeometryValidityFlag ) /** @@ -905,7 +906,7 @@ class CORE_EXPORT Qgis LosslessImageRendering = 0x1000, //!< Render images losslessly whenever possible, instead of the default lossy jpeg rendering used for some destination devices (e.g. PDF). This flag only works with builds based on Qt 5.13 or later. Render3DMap = 0x2000, //!< Render is for a 3D map }; - Q_DECLARE_FLAGS( MapSettingsFlags, MapSettingsFlag ) + Q_DECLARE_FLAGS( MapSettingsFlags, MapSettingsFlag ) SIP_MONKEYPATCH_FLAGS_UNNEST( QgsMapSettings, Flags ) Q_ENUM( MapSettingsFlag ) /** @@ -932,7 +933,7 @@ class CORE_EXPORT Qgis Render3DMap = 0x4000, //!< Render is for a 3D map ApplyClipAfterReprojection = 0x8000, //!< Feature geometry clipping to mapExtent() must be performed after the geometries are transformed using coordinateTransform(). Usually feature geometry clipping occurs using the extent() in the layer's CRS prior to geometry transformation, but in some cases when extent() could not be accurately calculated it is necessary to clip geometries to mapExtent() AFTER transforming them using coordinateTransform(). }; - Q_DECLARE_FLAGS( RenderContextFlags, RenderContextFlag ) + Q_DECLARE_FLAGS( RenderContextFlags, RenderContextFlag ) SIP_MONKEYPATCH_FLAGS_UNNEST( QgsRenderContext, Flags ) Q_ENUM( RenderContextFlag ) // refs for below dox: https://github.com/qgis/QGIS/pull/1286#issuecomment-39806854 diff --git a/src/core/qgis_sip.h b/src/core/qgis_sip.h index 9c98030087b..2538dd2705d 100644 --- a/src/core/qgis_sip.h +++ b/src/core/qgis_sip.h @@ -255,6 +255,7 @@ */ #define SIP_MONKEYPATCH_SCOPEENUM #define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS,FORMERNAME) +#define SIP_MONKEYPATCH_FLAGS_UNNEST(OUTSIDE_CLASS,FORMERNAME) #define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME) /*