Skip to content

Commit

Permalink
Allow maximum number of entries to show in relation reference widget
Browse files Browse the repository at this point in the history
to be configurable via an advanced setting configuration option

In some circumstances 100 is not enough
  • Loading branch information
nyalldawson committed Feb 5, 2019
1 parent ce8684d commit a97ce69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions resources/qgis_global_settings.ini
Expand Up @@ -77,3 +77,9 @@ helpSearchPath=https://docs.qgis.org/$qgis_short_version/$qgis_locale/docs/user_
[providers]
# Default timeout for PostgreSQL servers (seconds)
PostgreSQL\default_timeout=30

[gui]
# Maximum number of entries to show in Relation Reference widgets. Too large a number here can
# cause performance issues, as the records must all be loaded from the related table on display.
maxEntriesRelationWidget=100

3 changes: 2 additions & 1 deletion src/core/qgsfeaturefiltermodel.cpp
Expand Up @@ -19,6 +19,7 @@
#include "qgsvectorlayer.h"
#include "qgsconditionalstyle.h"
#include "qgsapplication.h"
#include "qgssettings.h"

QgsFeatureFilterModel::QgsFeatureFilterModel( QObject *parent )
: QAbstractItemModel( parent )
Expand Down Expand Up @@ -353,7 +354,7 @@ void QgsFeatureFilterModel::scheduledReload()
request.setSubsetOfAttributes( attributes, mSourceLayer->fields() );
request.setFlags( QgsFeatureRequest::NoGeometry );

request.setLimit( 100 );
request.setLimit( QgsSettings().value( QStringLiteral( "maxEntriesRelationWidget" ), 100, QgsSettings::Gui ).toInt() );

mGatherer = new QgsFieldExpressionValuesGatherer( mSourceLayer, mDisplayExpression, mIdentifierField, request );
mGatherer->setData( mShouldReloadCurrentFeature );
Expand Down

0 comments on commit a97ce69

Please sign in to comment.