Skip to content

Commit 9488f06

Browse files
committedApr 30, 2020
code layout
1 parent b97543d commit 9488f06

File tree

7 files changed

+13
-4
lines changed

7 files changed

+13
-4
lines changed
 

‎python/core/auto_generated/qgsfeaturepickermodel.sip.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Returns the current feature
4848

4949
signals:
5050
void featureChanged( const QgsFeature &feature );
51+
%Docstring
52+
Emitted when the current feature changes
53+
%End
5154

5255

5356
};

‎python/core/auto_generated/qgsfeaturepickermodelbase.sip.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ Update the request to match the current feature to be reloaded
250250
%End
251251

252252
void setExtraIdentifierValueUnguarded( const QVariant &identifierValue );
253+
%Docstring
254+
This will set the identifier value to be set in the model even if it doesn't exist currently in the data
255+
%End
253256

254257

255258

‎src/core/qgsfeaturefiltermodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ QgsFeatureFilterModel::QgsFeatureFilterModel( QObject *parent )
4040
{
4141
setFetchGeometry( false );
4242
setFetchLimit( QgsSettings().value( QStringLiteral( "maxEntriesRelationWidget" ), 100, QgsSettings::Gui ).toInt() );
43-
setExtraIdentifierValueUnguarded( QVariantList() );
43+
setExtraIdentifierValueUnguarded( nullIentifier() );
4444
}
4545

4646
QString QgsFeatureFilterModel::identifierField() const

‎src/core/qgsfeaturepickermodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ QgsFeaturePickerModel::QgsFeaturePickerModel( QObject *parent )
2525
: QgsFeaturePickerModelBase( parent )
2626
{
2727
setFetchGeometry( true );
28-
setExtraIdentifierValueUnguarded( FID_NULL );
28+
setExtraIdentifierValueUnguarded( nullIentifier() );
2929

3030
connect( this, &QgsFeaturePickerModelBase::extraIdentifierValueIndexChanged, this, [ = ]() {emit featureChanged( feature() );} );
3131
}

‎src/core/qgsfeaturepickermodel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class CORE_EXPORT QgsFeaturePickerModel : public QgsFeaturePickerModelBase
5555
QgsFeature feature() const;
5656

5757
signals:
58+
//! Emitted when the current feature changes
5859
void featureChanged( const QgsFeature &feature );
5960

6061

‎src/core/qgsfeaturepickermodelbase.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ class CORE_EXPORT QgsFeaturePickerModelBase : public QAbstractItemModel SIP_ABST
274274
//! Update the request to match the current feature to be reloaded
275275
virtual void requestToReloadCurrentFeature( QgsFeatureRequest &request ) = 0;
276276

277+
//! This will set the identifier value to be set in the model even if it doesn't exist currently in the data
277278
void setExtraIdentifierValueUnguarded( const QVariant &identifierValue );
278279

279280
#ifndef SIP_RUN
@@ -284,10 +285,11 @@ class CORE_EXPORT QgsFeaturePickerModelBase : public QAbstractItemModel SIP_ABST
284285
*/
285286
virtual QSet<QString> requestedAttributes() const {return {};}
286287

288+
//! Creates the value gatherer
287289
virtual QgsFeatureExpressionValuesGatherer *createValuesGatherer( const QgsFeatureRequest &request ) const = 0;
288290

289291
//! Creates an entry with just the identifier so the feature can be retrieved in a next iteration
290-
virtual QgsFeatureExpressionValuesGatherer::Entry createEntry( const QVariant &identifer ) const = 0;
292+
virtual QgsFeatureExpressionValuesGatherer::Entry createEntry( const QVariant &identifier ) const = 0;
291293

292294
//! Returns the identifier of the given entry
293295
virtual QVariant entryIdentifier( const QgsFeatureExpressionValuesGatherer::Entry &entry ) const = 0;

‎tests/src/python/test_qgsfeaturepicker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def testLineEdit(self):
102102
spy = QSignalSpy(w.featureChanged)
103103
spy.wait()
104104
w.findChild(QComboBox).lineEdit().clear()
105-
QTest.keyClicks(w.findChild(QComboBox).lineEdit(), "test99");
105+
QTest.keyClicks(w.findChild(QComboBox).lineEdit(), "test99")
106106
spy.wait()
107107
self.assertEqual(w.feature().id(), 99)
108108

0 commit comments

Comments
 (0)
Please sign in to comment.