File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,9 @@ void QgsSearchQueryBuilder::getFieldValues( int limit )
117
117
mModelValues ->blockSignals ( true );
118
118
lstValues->setUpdatesEnabled ( false );
119
119
120
+ /* *MH: keep already inserted values in a set. Querying is much faster compared to QStandardItemModel::findItems*/
121
+ QSet<QString> insertedValues;
122
+
120
123
while ( mLayer ->nextFeature ( feat ) &&
121
124
( limit == 0 || mModelValues ->rowCount () != limit ) )
122
125
{
@@ -130,12 +133,12 @@ void QgsSearchQueryBuilder::getFieldValues( int limit )
130
133
}
131
134
132
135
// add item only if it's not there already
133
- QList<QStandardItem *> items = mModelValues ->findItems ( value );
134
- if ( items.isEmpty () )
136
+ if ( !insertedValues.contains ( value ) )
135
137
{
136
138
QStandardItem *myItem = new QStandardItem ( value );
137
139
myItem->setEditable ( false );
138
140
mModelValues ->insertRow ( mModelValues ->rowCount (), myItem );
141
+ insertedValues.insert ( value );
139
142
}
140
143
}
141
144
// Unblock for normal use
You can’t perform that action at this time.
0 commit comments