diff --git a/python/PyQt6/core/auto_generated/qgsfields.sip.in b/python/PyQt6/core/auto_generated/qgsfields.sip.in index 2a3168fa393..2df5fa580d3 100644 --- a/python/PyQt6/core/auto_generated/qgsfields.sip.in +++ b/python/PyQt6/core/auto_generated/qgsfields.sip.in @@ -28,6 +28,9 @@ In addition to storing a list of :py:class:`QgsField` instances, it also: %TypeHeaderCode #include "qgsfields.h" %End + public: + static const QMetaObject staticMetaObject; + public: enum FieldOrigin /BaseType=IntEnum/ @@ -289,7 +292,7 @@ name of the field. .. seealso:: :py:func:`lookupField` %End - int lookupField( const QString &fieldName ) const; + int lookupField( const QString &fieldName ) const; %Docstring Looks up field's index from the field name. This method matches in the following order: diff --git a/python/core/auto_generated/qgsfields.sip.in b/python/core/auto_generated/qgsfields.sip.in index b898d911e6a..f94f5c453b7 100644 --- a/python/core/auto_generated/qgsfields.sip.in +++ b/python/core/auto_generated/qgsfields.sip.in @@ -28,6 +28,9 @@ In addition to storing a list of :py:class:`QgsField` instances, it also: %TypeHeaderCode #include "qgsfields.h" %End + public: + static const QMetaObject staticMetaObject; + public: enum FieldOrigin @@ -289,7 +292,7 @@ name of the field. .. seealso:: :py:func:`lookupField` %End - int lookupField( const QString &fieldName ) const; + int lookupField( const QString &fieldName ) const; %Docstring Looks up field's index from the field name. This method matches in the following order: diff --git a/src/core/qgsfields.h b/src/core/qgsfields.h index 4384248ef4d..975ebdcaf75 100644 --- a/src/core/qgsfields.h +++ b/src/core/qgsfields.h @@ -43,6 +43,12 @@ class QgsFieldsPrivate; */ class CORE_EXPORT QgsFields { + Q_GADGET + + Q_PROPERTY( bool isEmpty READ isEmpty ) + Q_PROPERTY( int count READ count ) + Q_PROPERTY( QStringList names READ names ) + public: enum FieldOrigin @@ -173,7 +179,7 @@ class CORE_EXPORT QgsFields * \param i Index of the field which needs to be checked * \returns TRUE if the field exists */ - bool exists( int i ) const; + Q_INVOKABLE bool exists( int i ) const; #ifndef SIP_RUN //! Gets field at particular index (must be in range 0..N-1) @@ -354,7 +360,7 @@ class CORE_EXPORT QgsFields * \returns The field index if found or -1 in case it cannot be found. * \see lookupField For a more tolerant alternative. */ - int indexFromName( const QString &fieldName ) const; + Q_INVOKABLE int indexFromName( const QString &fieldName ) const; /** * Gets the field index from the field name. @@ -367,7 +373,7 @@ class CORE_EXPORT QgsFields * \returns The field index if found or -1 in case it cannot be found. * \see lookupField For a more tolerant alternative. */ - int indexOf( const QString &fieldName ) const; + Q_INVOKABLE int indexOf( const QString &fieldName ) const; /** * Looks up field's index from the field name. @@ -382,7 +388,7 @@ class CORE_EXPORT QgsFields * \returns The field index if found or -1 in case it cannot be found. * \see indexFromName For a more performant and precise but less tolerant alternative. */ - int lookupField( const QString &fieldName ) const; + Q_INVOKABLE int lookupField( const QString &fieldName ) const; /** * Utility function to get list of attribute indexes diff --git a/src/core/vector/qgsvectorlayer.h b/src/core/vector/qgsvectorlayer.h index 62f23ffd380..3ecfc116e2c 100644 --- a/src/core/vector/qgsvectorlayer.h +++ b/src/core/vector/qgsvectorlayer.h @@ -405,6 +405,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte Q_PROPERTY( QgsEditFormConfig editFormConfig READ editFormConfig WRITE setEditFormConfig NOTIFY editFormConfigChanged ) Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged ) Q_PROPERTY( bool supportsEditing READ supportsEditing NOTIFY supportsEditingChanged ) + Q_PROPERTY( QgsFields fields READ fields NOTIFY updatedFields ) public: