Short connection timeout for symbol selector preview feature fetching

Because we don't really care if we couldn't fulfill this request,
and the request itself is blocking UI.
This commit is contained in:
Nyall Dawson 2018-08-06 12:20:43 +10:00
parent 70277635a2
commit f3235f7c43

View File

@ -253,7 +253,8 @@ QgsSymbolSelectorWidget::QgsSymbolSelectorWidget( QgsSymbol *symbol, QgsStyle *s
//get first feature from layer for previews
if ( mVectorLayer )
{
QgsFeatureIterator it = mVectorLayer->getFeatures( QgsFeatureRequest().setLimit( 1 ) );
// short timeout for request - it doesn't really matter if we don't get the feature, and this call is blocking UI
QgsFeatureIterator it = mVectorLayer->getFeatures( QgsFeatureRequest().setLimit( 1 ).setConnectionTimeout( 100 ) );
it.nextFeature( mPreviewFeature );
mPreviewExpressionContext.appendScopes( QgsExpressionContextUtils::globalProjectLayerScopes( mVectorLayer ) );
mPreviewExpressionContext.setFeature( mPreviewFeature );