49 Q_PROPERTY(
bool isEmpty READ isEmpty )
50 Q_PROPERTY(
int count READ count )
51 Q_PROPERTY( QStringList names READ names )
75 int originIndex = -1 ;
117 bool rename(
int fieldIdx, const QString &name )
SIP_HOLDGIL;
127 void remove(
int fieldIdx );
137 if ( a0 < 0 || a0 >= sipCpp->count() )
139 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
144 sipCpp->remove( a0 );
161 sipRes = sipCpp->count();
184 Q_INVOKABLE
bool exists(
int i ) const
SIP_HOLDGIL;
195 SIP_SSIZE_T idx = sipConvertFromSequenceIndex( a0, sipCpp->count() );
199 sipRes =
new QgsField( sipCpp->operator[]( idx ) );
206 const int fieldIdx = sipCpp->lookupField( *a0 );
207 if ( fieldIdx == -1 )
209 PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
214 sipRes = sipConvertFromType(
new QgsField( sipCpp->at( fieldIdx ) ), sipType_QgsField, Py_None );
233 if ( a0 < 0 || a0 >= sipCpp->count() )
235 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
240 sipRes =
new QgsField( sipCpp->at( a0 ) );
259 if ( a0 < 0 || a0 >= sipCpp->count() )
261 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
266 sipRes =
new QgsField( sipCpp->field( a0 ) );
285 int fieldIdx = sipCpp->indexFromName( *a0 );
286 if ( fieldIdx == -1 )
288 PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
293 sipRes =
new QgsField( sipCpp->field( *a0 ) );
313 if ( a0 < 0 || a0 >= sipCpp->count() )
315 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
320 sipRes = sipCpp->fieldOrigin( a0 );
334 int fieldOriginIndex(
int fieldIdx )
const;
346 int fieldOriginIndex(
int fieldIdx )
const SIP_HOLDGIL;
348 if ( a0 < 0 || a0 >= sipCpp->count() )
350 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
355 sipRes = sipCpp->fieldOriginIndex( a0 );
373 Q_INVOKABLE
int indexFromName(
const QString &fieldName )
const SIP_HOLDGIL;
386 Q_INVOKABLE
int indexOf(
const QString &fieldName )
const SIP_HOLDGIL;
401 Q_INVOKABLE
int lookupField(
const QString &fieldName )
const SIP_HOLDGIL;
421 QIcon iconForField(
int fieldIdx,
bool considerOrigin =
false ) const
SIP_FACTORY;
430 QIcon iconForField(
int fieldIdx,
bool considerOrigin =
false ) const
SIP_FACTORY;
432 if ( a0 < 0 || a0 >= sipCpp->count() )
434 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
439 sipRes =
new QIcon( sipCpp->iconForField( a0 ) );
452 static QIcon iconForFieldType( QMetaType::Type type, QMetaType::Type subType = QMetaType::Type::UnknownType,
const QString &typeString = QString() );
463 Q_DECL_DEPRECATED
static QIcon iconForFieldType( QVariant::Type type, QVariant::Type subType,
const QString &typeString = QString() )
SIP_DEPRECATED;
466 operator QVariant()
const
468 return QVariant::fromValue( *
this );
475 int idx = ( int )sipConvertFromSequenceIndex( a0, sipCpp->count() );
479 ( *sipCpp )[idx] = *a1;
488 class const_iterator;
494 typedef std::random_access_iterator_tag iterator_category;
495 typedef qptrdiff difference_type;
506 inline QgsField &operator[]( difference_type j )
const {
return d[j].
field; }
507 inline bool operator==(
const iterator &o )
const noexcept {
return d == o.d; }
508 inline bool operator!=(
const iterator &o )
const noexcept {
return d != o.d; }
509 inline bool operator<(
const iterator &other )
const noexcept {
return d < other.d; }
510 inline bool operator<=(
const iterator &other )
const noexcept {
return d <= other.d; }
511 inline bool operator>(
const iterator &other )
const noexcept {
return d > other.d; }
512 inline bool operator>=(
const iterator &other )
const noexcept {
return d >= other.d; }
514 inline iterator &operator++() { ++d;
return *
this; }
515 inline iterator operator++(
int ) {
QgsFields::Field *n = d; ++d;
return n; }
516 inline iterator &operator--() { d--;
return *
this; }
517 inline iterator operator--(
int ) {
QgsFields::Field *n = d; d--;
return n; }
518 inline iterator &operator+=( difference_type j ) { d += j;
return *
this; }
519 inline iterator &operator-=( difference_type j ) { d -= j;
return *
this; }
520 inline iterator
operator+( difference_type j )
const {
return iterator( d + j ); }
521 inline iterator
operator-( difference_type j )
const {
return iterator( d - j ); }
522 inline int operator-( iterator j )
const {
return int( d - j.d ); }
524 friend class iterator;
531 typedef std::random_access_iterator_tag iterator_category;
532 typedef qptrdiff difference_type;
534 inline const_iterator()
539 inline const_iterator(
const const_iterator &o )
541 inline explicit const_iterator(
const iterator &o )
544 inline const QgsField *operator->()
const {
return &d->
field; }
545 inline const QgsField &operator[]( difference_type j )
const noexcept {
return d[j].
field; }
546 inline bool operator==(
const const_iterator &o )
const noexcept {
return d == o.d; }
547 inline bool operator!=(
const const_iterator &o )
const noexcept {
return d != o.d; }
548 inline bool operator<(
const const_iterator &other )
const noexcept {
return d < other.d; }
549 inline bool operator<=(
const const_iterator &other )
const noexcept {
return d <= other.d; }
550 inline bool operator>(
const const_iterator &other )
const noexcept {
return d > other.d; }
551 inline bool operator>=(
const const_iterator &other )
const noexcept {
return d >= other.d; }
552 inline const_iterator &operator++() { ++d;
return *
this; }
553 inline const_iterator operator++(
int ) {
const QgsFields::Field *n = d; ++d;
return n; }
554 inline const_iterator &operator--() { d--;
return *
this; }
555 inline const_iterator operator--(
int ) {
const QgsFields::Field *n = d; --d;
return n; }
556 inline const_iterator &operator+=( difference_type j ) { d += j;
return *
this; }
557 inline const_iterator &operator-=( difference_type j ) { d -= j;
return *
this; }
558 inline const_iterator
operator+( difference_type j )
const {
return const_iterator( d + j ); }
559 inline const_iterator
operator-( difference_type j )
const {
return const_iterator( d - j ); }
560 inline int operator-( const_iterator j )
const {
return int( d - j.d ); }
562 const_iterator &operator= (
const const_iterator & ) =
delete;
564 friend class const_iterator;
573 const_iterator constBegin() const noexcept;
580 const_iterator constEnd() const noexcept;
587 const_iterator begin() const noexcept;
594 const_iterator end() const noexcept;
615 QSharedDataPointer<QgsFieldsPrivate> d;