Skip to content
Permalink
Browse files

Merge pull request #5783 from pblottiere/ref_rel_perf_218

[2.18] QgsRelationReferenceWidget slowness
  • Loading branch information
pblottiere committed Dec 15, 2017
2 parents 2ef6a82 + fd7fc94 commit f4b007ec1a618b313df1ecfdfa1a3bd5fff17141
@@ -928,7 +928,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
mVariableEditor->reloadContext();
mVariableEditor->setEditableScopeIndex( 0 );


const QString key = "/QgsRelationReferenceWidget/cacheSize";
mSettings->setValue( key, mSettings->value( key, 200000 ) );

mAdvancedSettingsEditor->setSettingsObject( mSettings );

@@ -479,7 +479,8 @@ void QgsRelationReferenceWidget::init()

QSet<QString> requestedAttrs;

QgsVectorLayerCache* layerCache = new QgsVectorLayerCache( mReferencedLayer, 100000, this );
const int cacheSize = QSettings().value( "/QgsRelationReferenceWidget/cacheSize" ).toInt();
QgsVectorLayerCache* layerCache = new QgsVectorLayerCache( mReferencedLayer, cacheSize, this );

if ( !mFilterFields.isEmpty() )
{
@@ -583,8 +584,14 @@ void QgsRelationReferenceWidget::init()
}
}

QVariant featId = mFeature.isValid() ? mFeature.id() : QVariant( QVariant::Int );
mComboBox->setCurrentIndex( mComboBox->findData( featId, QgsAttributeTableModel::FeatureIdRole ) );
if ( mFeature.isValid() )
{
mComboBox->setCurrentIndex( mComboBox->findData( mFeature.id(), QgsAttributeTableModel::FeatureIdRole ) );
}
else
{
mComboBox->setCurrentIndex( -1 );
}

// Only connect after iterating, to have only one iterator on the referenced table at once
connect( mComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( comboReferenceChanged( int ) ) );
@@ -71,7 +71,7 @@ void QgsRelationReferenceWidgetWrapper::initWidget( QWidget* editor )
if ( ctx->relation().name() == relation.name() )
{
mWidget->setEmbedForm( false );
mWidget->setReadOnlySelector( false );
mWidget->setReadOnlySelector( true );
mWidget->setAllowMapIdentification( false );
}
ctx = ctx->parentContext();

0 comments on commit f4b007e

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