From 4adc1c8278c37746c8ed721dde3576e90daeb3f3 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 6 Mar 2023 12:23:10 +1000 Subject: [PATCH] Fix python build --- .../core/auto_generated/qgsmaphittest.sip.in | 8 ++++-- src/core/qgsmaphittest.cpp | 20 ++++++++++++++ src/core/qgsmaphittest.h | 26 +++++++++++++++++-- 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/python/core/auto_generated/qgsmaphittest.sip.in b/python/core/auto_generated/qgsmaphittest.sip.in index aff817bc972..5c46ddaad7d 100644 --- a/python/core/auto_generated/qgsmaphittest.sip.in +++ b/python/core/auto_generated/qgsmaphittest.sip.in @@ -42,7 +42,9 @@ Constructor version used with only expressions to filter symbols (no extent or p Runs the map hit test %End - QMap> results() const; + + + QMap> resultsPy() const /PyName=results/; %Docstring Returns the hit test results, which are a map of layer ID to visible symbol legend keys. @@ -107,7 +109,9 @@ Constructor for QgsMapHitTestTask, filtering by expressions. :param layerFilterExpression: Expression string for each layer id to evaluate in order to refine the symbol selection %End - QMap> results() const; + + + QMap> resultsPy() const /PyName=results/; %Docstring Returns the hit test results, which are a map of layer ID to visible symbol legend keys. diff --git a/src/core/qgsmaphittest.cpp b/src/core/qgsmaphittest.cpp index 5eb65793a9a..9a9cd130b7b 100644 --- a/src/core/qgsmaphittest.cpp +++ b/src/core/qgsmaphittest.cpp @@ -96,6 +96,16 @@ QMap > QgsMapHitTest::results() const return mHitTestRuleKey; } +QMap > QgsMapHitTest::resultsPy() const +{ + QMap > res; + for ( auto it = mHitTestRuleKey.begin(); it != mHitTestRuleKey.end(); ++it ) + { + res.insert( it.key(), qgis::setToList( it.value() ) ); + } + return res; +} + bool QgsMapHitTest::symbolVisible( QgsSymbol *symbol, QgsVectorLayer *layer ) const { if ( !symbol || !layer ) @@ -296,6 +306,16 @@ QMap > QgsMapHitTestTask::results() const return mResults; } +QMap > QgsMapHitTestTask::resultsPy() const +{ + QMap > res; + for ( auto it = mResults.begin(); it != mResults.end(); ++it ) + { + res.insert( it.key(), qgis::setToList( it.value() ) ); + } + return res; +} + void QgsMapHitTestTask::prepare() { const QList< QgsMapLayer * > layers = mSettings.layers( true ); diff --git a/src/core/qgsmaphittest.h b/src/core/qgsmaphittest.h index e46ed9f4f2b..addc9e9e92e 100644 --- a/src/core/qgsmaphittest.h +++ b/src/core/qgsmaphittest.h @@ -61,9 +61,21 @@ class CORE_EXPORT QgsMapHitTest * Returns the hit test results, which are a map of layer ID to * visible symbol legend keys. * + * \note Not available in Python bindings * \since QGIS 3.32 */ - QMap> results() const; + QMap> results() const SIP_SKIP; + + ///@cond PRIVATE + + /** + * Returns the hit test results, which are a map of layer ID to + * visible symbol legend keys. + * + * \since QGIS 3.32 + */ + QMap> resultsPy() const SIP_PYNAME( results ); + ///@endcond PRIVATE /** * Tests whether a symbol is visible for a specified layer. @@ -164,8 +176,18 @@ class CORE_EXPORT QgsMapHitTestTask : public QgsTask /** * Returns the hit test results, which are a map of layer ID to * visible symbol legend keys. + * \note Not available in Python bindings */ - QMap> results() const; + QMap> results() const SIP_SKIP; + + ///@cond PRIVATE + + /** + * Returns the hit test results, which are a map of layer ID to + * visible symbol legend keys. + */ + QMap> resultsPy() const SIP_PYNAME( results ); + ///@endcond PRIVATE void cancel() override;