mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
try disconnect/connect for destroyIndex
This commit is contained in:
parent
43e905d7fc
commit
07caafe7c6
@ -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 )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user