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 ;
135 bool rename(
int fieldIdx, const QString &name )
SIP_HOLDGIL;
145 void remove(
int fieldIdx );
155 if ( a0 < 0 || a0 >= sipCpp->count() )
157 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
162 sipCpp->remove( a0 );
179 sipRes = sipCpp->count();
202 Q_INVOKABLE
bool exists(
int i ) const
SIP_HOLDGIL;
213 SIP_SSIZE_T idx = sipConvertFromSequenceIndex( a0, sipCpp->count() );
217 sipRes =
new QgsField( sipCpp->operator[]( idx ) );
224 const int fieldIdx = sipCpp->lookupField( *a0 );
225 if ( fieldIdx == -1 )
227 PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
232 sipRes = sipConvertFromType(
new QgsField( sipCpp->at( fieldIdx ) ), sipType_QgsField, Py_None );
251 if ( a0 < 0 || a0 >= sipCpp->count() )
253 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
258 sipRes =
new QgsField( sipCpp->at( a0 ) );
277 if ( a0 < 0 || a0 >= sipCpp->count() )
279 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
284 sipRes =
new QgsField( sipCpp->field( a0 ) );
303 int fieldIdx = sipCpp->indexFromName( *a0 );
304 if ( fieldIdx == -1 )
306 PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
311 sipRes =
new QgsField( sipCpp->field( *a0 ) );
331 if ( a0 < 0 || a0 >= sipCpp->count() )
333 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
338 sipRes = sipCpp->fieldOrigin( a0 );
352 int fieldOriginIndex(
int fieldIdx )
const;
364 int fieldOriginIndex(
int fieldIdx )
const SIP_HOLDGIL;
366 if ( a0 < 0 || a0 >= sipCpp->count() )
368 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
373 sipRes = sipCpp->fieldOriginIndex( a0 );
391 Q_INVOKABLE
int indexFromName(
const QString &fieldName )
const SIP_HOLDGIL;
404 Q_INVOKABLE
int indexOf(
const QString &fieldName )
const SIP_HOLDGIL;
419 Q_INVOKABLE
int lookupField(
const QString &fieldName )
const SIP_HOLDGIL;
439 QIcon iconForField(
int fieldIdx,
bool considerOrigin =
false ) const
SIP_FACTORY;
448 QIcon iconForField(
int fieldIdx,
bool considerOrigin =
false ) const
SIP_FACTORY;
450 if ( a0 < 0 || a0 >= sipCpp->count() )
452 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
457 sipRes =
new QIcon( sipCpp->iconForField( a0 ) );
470 static QIcon iconForFieldType( QMetaType::Type type, QMetaType::Type subType = QMetaType::Type::UnknownType,
const QString &typeString = QString() );
481 Q_DECL_DEPRECATED
static QIcon iconForFieldType( QVariant::Type type, QVariant::Type subType,
const QString &typeString = QString() )
SIP_DEPRECATED;
484 operator QVariant()
const
486 return QVariant::fromValue( *
this );
493 int idx = ( int )sipConvertFromSequenceIndex( a0, sipCpp->count() );
497 ( *sipCpp )[idx] = *a1;
506 class const_iterator;
512 typedef std::random_access_iterator_tag iterator_category;
513 typedef qptrdiff difference_type;
524 inline QgsField &operator[]( difference_type j )
const {
return d[j].
field; }
525 inline bool operator==(
const iterator &o )
const noexcept {
return d == o.d; }
526 inline bool operator!=(
const iterator &o )
const noexcept {
return d != o.d; }
527 inline bool operator<(
const iterator &other )
const noexcept {
return d < other.d; }
528 inline bool operator<=(
const iterator &other )
const noexcept {
return d <= other.d; }
529 inline bool operator>(
const iterator &other )
const noexcept {
return d > other.d; }
530 inline bool operator>=(
const iterator &other )
const noexcept {
return d >= other.d; }
532 inline iterator &operator++() { ++d;
return *
this; }
533 inline iterator operator++(
int ) {
QgsFields::Field *n = d; ++d;
return n; }
534 inline iterator &operator--() { d--;
return *
this; }
535 inline iterator operator--(
int ) {
QgsFields::Field *n = d; d--;
return n; }
536 inline iterator &operator+=( difference_type j ) { d += j;
return *
this; }
537 inline iterator &operator-=( difference_type j ) { d -= j;
return *
this; }
538 inline iterator
operator+( difference_type j )
const {
return iterator( d + j ); }
539 inline iterator
operator-( difference_type j )
const {
return iterator( d - j ); }
540 inline int operator-( iterator j )
const {
return int( d - j.d ); }
542 friend class iterator;
549 typedef std::random_access_iterator_tag iterator_category;
550 typedef qptrdiff difference_type;
552 inline const_iterator()
557 inline const_iterator(
const const_iterator &o )
559 inline explicit const_iterator(
const iterator &o )
562 inline const QgsField *operator->()
const {
return &d->
field; }
563 inline const QgsField &operator[]( difference_type j )
const noexcept {
return d[j].
field; }
564 inline bool operator==(
const const_iterator &o )
const noexcept {
return d == o.d; }
565 inline bool operator!=(
const const_iterator &o )
const noexcept {
return d != o.d; }
566 inline bool operator<(
const const_iterator &other )
const noexcept {
return d < other.d; }
567 inline bool operator<=(
const const_iterator &other )
const noexcept {
return d <= other.d; }
568 inline bool operator>(
const const_iterator &other )
const noexcept {
return d > other.d; }
569 inline bool operator>=(
const const_iterator &other )
const noexcept {
return d >= other.d; }
570 inline const_iterator &operator++() { ++d;
return *
this; }
571 inline const_iterator operator++(
int ) {
const QgsFields::Field *n = d; ++d;
return n; }
572 inline const_iterator &operator--() { d--;
return *
this; }
573 inline const_iterator operator--(
int ) {
const QgsFields::Field *n = d; --d;
return n; }
574 inline const_iterator &operator+=( difference_type j ) { d += j;
return *
this; }
575 inline const_iterator &operator-=( difference_type j ) { d -= j;
return *
this; }
576 inline const_iterator
operator+( difference_type j )
const {
return const_iterator( d + j ); }
577 inline const_iterator
operator-( difference_type j )
const {
return const_iterator( d - j ); }
578 inline int operator-( const_iterator j )
const {
return int( d - j.d ); }
580 const_iterator &operator= (
const const_iterator & ) =
delete;
582 friend class const_iterator;
591 const_iterator constBegin() const noexcept;
598 const_iterator constEnd() const noexcept;
605 const_iterator begin() const noexcept;
612 const_iterator end() const noexcept;
633 QSharedDataPointer<QgsFieldsPrivate> d;