mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-09 00:08:52 -04:00
code layout
This commit is contained in:
parent
b97543d9cc
commit
9488f06025
@ -48,6 +48,9 @@ Returns the current feature
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void featureChanged( const QgsFeature &feature );
|
void featureChanged( const QgsFeature &feature );
|
||||||
|
%Docstring
|
||||||
|
Emitted when the current feature changes
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -250,6 +250,9 @@ Update the request to match the current feature to be reloaded
|
|||||||
%End
|
%End
|
||||||
|
|
||||||
void setExtraIdentifierValueUnguarded( const QVariant &identifierValue );
|
void setExtraIdentifierValueUnguarded( const QVariant &identifierValue );
|
||||||
|
%Docstring
|
||||||
|
This will set the identifier value to be set in the model even if it doesn't exist currently in the data
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ QgsFeatureFilterModel::QgsFeatureFilterModel( QObject *parent )
|
|||||||
{
|
{
|
||||||
setFetchGeometry( false );
|
setFetchGeometry( false );
|
||||||
setFetchLimit( QgsSettings().value( QStringLiteral( "maxEntriesRelationWidget" ), 100, QgsSettings::Gui ).toInt() );
|
setFetchLimit( QgsSettings().value( QStringLiteral( "maxEntriesRelationWidget" ), 100, QgsSettings::Gui ).toInt() );
|
||||||
setExtraIdentifierValueUnguarded( QVariantList() );
|
setExtraIdentifierValueUnguarded( nullIentifier() );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QgsFeatureFilterModel::identifierField() const
|
QString QgsFeatureFilterModel::identifierField() const
|
||||||
|
@ -25,7 +25,7 @@ QgsFeaturePickerModel::QgsFeaturePickerModel( QObject *parent )
|
|||||||
: QgsFeaturePickerModelBase( parent )
|
: QgsFeaturePickerModelBase( parent )
|
||||||
{
|
{
|
||||||
setFetchGeometry( true );
|
setFetchGeometry( true );
|
||||||
setExtraIdentifierValueUnguarded( FID_NULL );
|
setExtraIdentifierValueUnguarded( nullIentifier() );
|
||||||
|
|
||||||
connect( this, &QgsFeaturePickerModelBase::extraIdentifierValueIndexChanged, this, [ = ]() {emit featureChanged( feature() );} );
|
connect( this, &QgsFeaturePickerModelBase::extraIdentifierValueIndexChanged, this, [ = ]() {emit featureChanged( feature() );} );
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ class CORE_EXPORT QgsFeaturePickerModel : public QgsFeaturePickerModelBase
|
|||||||
QgsFeature feature() const;
|
QgsFeature feature() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
//! Emitted when the current feature changes
|
||||||
void featureChanged( const QgsFeature &feature );
|
void featureChanged( const QgsFeature &feature );
|
||||||
|
|
||||||
|
|
||||||
|
@ -274,6 +274,7 @@ class CORE_EXPORT QgsFeaturePickerModelBase : public QAbstractItemModel SIP_ABST
|
|||||||
//! Update the request to match the current feature to be reloaded
|
//! Update the request to match the current feature to be reloaded
|
||||||
virtual void requestToReloadCurrentFeature( QgsFeatureRequest &request ) = 0;
|
virtual void requestToReloadCurrentFeature( QgsFeatureRequest &request ) = 0;
|
||||||
|
|
||||||
|
//! This will set the identifier value to be set in the model even if it doesn't exist currently in the data
|
||||||
void setExtraIdentifierValueUnguarded( const QVariant &identifierValue );
|
void setExtraIdentifierValueUnguarded( const QVariant &identifierValue );
|
||||||
|
|
||||||
#ifndef SIP_RUN
|
#ifndef SIP_RUN
|
||||||
@ -284,10 +285,11 @@ class CORE_EXPORT QgsFeaturePickerModelBase : public QAbstractItemModel SIP_ABST
|
|||||||
*/
|
*/
|
||||||
virtual QSet<QString> requestedAttributes() const {return {};}
|
virtual QSet<QString> requestedAttributes() const {return {};}
|
||||||
|
|
||||||
|
//! Creates the value gatherer
|
||||||
virtual QgsFeatureExpressionValuesGatherer *createValuesGatherer( const QgsFeatureRequest &request ) const = 0;
|
virtual QgsFeatureExpressionValuesGatherer *createValuesGatherer( const QgsFeatureRequest &request ) const = 0;
|
||||||
|
|
||||||
//! Creates an entry with just the identifier so the feature can be retrieved in a next iteration
|
//! Creates an entry with just the identifier so the feature can be retrieved in a next iteration
|
||||||
virtual QgsFeatureExpressionValuesGatherer::Entry createEntry( const QVariant &identifer ) const = 0;
|
virtual QgsFeatureExpressionValuesGatherer::Entry createEntry( const QVariant &identifier ) const = 0;
|
||||||
|
|
||||||
//! Returns the identifier of the given entry
|
//! Returns the identifier of the given entry
|
||||||
virtual QVariant entryIdentifier( const QgsFeatureExpressionValuesGatherer::Entry &entry ) const = 0;
|
virtual QVariant entryIdentifier( const QgsFeatureExpressionValuesGatherer::Entry &entry ) const = 0;
|
||||||
|
@ -102,7 +102,7 @@ class TestQgsRelationEditWidget(unittest.TestCase):
|
|||||||
spy = QSignalSpy(w.featureChanged)
|
spy = QSignalSpy(w.featureChanged)
|
||||||
spy.wait()
|
spy.wait()
|
||||||
w.findChild(QComboBox).lineEdit().clear()
|
w.findChild(QComboBox).lineEdit().clear()
|
||||||
QTest.keyClicks(w.findChild(QComboBox).lineEdit(), "test99");
|
QTest.keyClicks(w.findChild(QComboBox).lineEdit(), "test99")
|
||||||
spy.wait()
|
spy.wait()
|
||||||
self.assertEqual(w.feature().id(), 99)
|
self.assertEqual(w.feature().id(), 99)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user