Skip to content
Permalink
Browse files

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 c0b4d9b9f92191b9f2573f64cdb0f9dcce24b876
Showing with 8 additions and 1 deletion.
  1. +6 −0 resources/qgis_global_settings.ini
  2. +2 −1 src/core/qgsfeaturefiltermodel.cpp
@@ -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

@@ -18,6 +18,7 @@

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

QgsFeatureFilterModel::QgsFeatureFilterModel( QObject *parent )
: QAbstractItemModel( parent )
@@ -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 );

0 comments on commit c0b4d9b

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