Skip to content
Permalink
Browse files

try disconnect/connect for destroyIndex

  • Loading branch information
lbartoletti committed Apr 25, 2018
1 parent 43e905d commit 07caafe7c63a89420cbd9ad935e2fbd1349e67a7
@@ -73,7 +73,7 @@ Configure extent - if not null, it will index only that area
.. versionadded:: 2.14
%End

void setRenderContext( const QgsRenderContext &context );
void setRenderContext( const QgsRenderContext *context );
%Docstring
Configure render context - if not null, it will use to index only visible feature

@@ -663,12 +663,19 @@ void QgsPointLocator::setExtent( const QgsRectangle *extent )
destroyIndex();
}

void QgsPointLocator::setRenderContext( const QgsRenderContext &context )
void QgsPointLocator::setRenderContext( const QgsRenderContext *context )
{
mContext = std::unique_ptr<QgsRenderContext>( new QgsRenderContext( context ) );
disconnect( mLayer, &QgsVectorLayer::styleChanged, this, &QgsPointLocator::destroyIndex );

connect( mLayer, &QgsVectorLayer::styleChanged, this, &QgsPointLocator::destroyIndex );
destroyIndex();
mContext.reset( nullptr );

if ( context )
{
mContext = std::unique_ptr<QgsRenderContext>( new QgsRenderContext( *context ) );
connect( mLayer, &QgsVectorLayer::styleChanged, this, &QgsPointLocator::destroyIndex );
}

}

bool QgsPointLocator::init( int maxFeaturesToIndex )
@@ -99,7 +99,7 @@ class CORE_EXPORT QgsPointLocator : public QObject
* Configure render context - if not null, it will use to index only visible feature
* \since QGIS 3.2
*/
void setRenderContext( const QgsRenderContext &context );
void setRenderContext( const QgsRenderContext *context );

/**
* The type of a snap result or the filter type for a snap request.
@@ -363,7 +363,10 @@ void QgsSnappingUtils::prepareIndex( const QList<LayerAndAreaOfInterest> &layers
QgsPointLocator *loc = locatorForLayer( vl );

if ( !mEnableSnappingForInvisibleFeature )
loc->setRenderContext( QgsRenderContext::fromMapSettings( mMapSettings ) );
{
QgsRenderContext ctx = QgsRenderContext::fromMapSettings( mMapSettings );
loc->setRenderContext( &ctx );
}

if ( mStrategy == IndexExtent )
{

0 comments on commit 07caafe

Please sign in to comment.
You can’t perform that action at this time.