mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-22 00:06:12 -05:00
Merge pull request #57166 from nirvn/fields_gadget
[qml] Make QgsFields a QGadet and make some functions Q_INVOKABLE
This commit is contained in:
commit
b9898d0fa1
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user