Skip to content

Commit

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

In some circumstances 100 is not enough

(cherry picked from commit a97ce69)
  • Loading branch information
nyalldawson committed Feb 7, 2019
1 parent ae21d07 commit c0b4d9b
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 @@ -18,6 +18,7 @@

#include "qgsvectorlayer.h"
#include "qgsconditionalstyle.h"
#include "qgssettings.h"

QgsFeatureFilterModel::QgsFeatureFilterModel( QObject *parent )
: QAbstractItemModel( parent )
Expand Down Expand Up @@ -357,7 +358,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 c0b4d9b

Please sign in to comment.