135 bool rename(
int fieldIdx, const QString &name )
SIP_HOLDGIL;
145 void remove(
int fieldIdx );
156 if ( a0 < 0 || a0 >= sipCpp->count() )
158 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
163 sipCpp->remove( a0 );
182 sipRes = sipCpp->count();
206 Q_INVOKABLE
bool exists(
int i ) const
SIP_HOLDGIL;
210 QgsField operator[](
int i )
const;
218 SIP_SSIZE_T idx = sipConvertFromSequenceIndex( a0, sipCpp->count() );
222 sipRes =
new QgsField( sipCpp->operator[]( idx ) );
231 const int fieldIdx = sipCpp->lookupField( *a0 );
232 if ( fieldIdx == -1 )
234 PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
239 sipRes = sipConvertFromType(
new QgsField( sipCpp->at( fieldIdx ) ), sipType_QgsField, Py_None );
260 if ( a0 < 0 || a0 >= sipCpp->count() )
262 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
267 sipRes =
new QgsField( sipCpp->at( a0 ) );
288 if ( a0 < 0 || a0 >= sipCpp->count() )
290 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
295 sipRes =
new QgsField( sipCpp->field( a0 ) );
306 QgsField field(
const QString &name )
const SIP_FACTORY;
316 int fieldIdx = sipCpp->indexFromName( *a0 );
317 if ( fieldIdx == -1 )
319 PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
324 sipRes =
new QgsField( sipCpp->field( *a0 ) );
346 if ( a0 < 0 || a0 >= sipCpp->count() )
348 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
353 sipRes = sipCpp->fieldOrigin( a0 );
368 int fieldOriginIndex(
int fieldIdx )
const;
381 int fieldOriginIndex(
int fieldIdx )
const SIP_HOLDGIL;
383 if ( a0 < 0 || a0 >= sipCpp->count() )
385 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
390 sipRes = sipCpp->fieldOriginIndex( a0 );
409 Q_INVOKABLE
int indexFromName(
const QString &fieldName )
const SIP_HOLDGIL;
422 Q_INVOKABLE
int indexOf(
const QString &fieldName )
const SIP_HOLDGIL;
437 Q_INVOKABLE
int lookupField(
const QString &fieldName )
const SIP_HOLDGIL;
447 bool operator==( const QgsFields &other ) const
SIP_HOLDGIL;
457 QIcon iconForField(
int fieldIdx,
bool considerOrigin =
false ) const
SIP_FACTORY;
467 QIcon iconForField(
int fieldIdx,
bool considerOrigin =
false ) const
SIP_FACTORY;
469 if ( a0 < 0 || a0 >= sipCpp->count() )
471 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
476 sipRes =
new QIcon( sipCpp->iconForField( a0 ) );
490 static QIcon iconForFieldType( QMetaType::Type type, QMetaType::Type subType = QMetaType::Type::UnknownType,
const QString &typeString = QString() );
501 Q_DECL_DEPRECATED
static QIcon iconForFieldType( QVariant::Type type, QVariant::Type subType,
const QString &typeString = QString() )
SIP_DEPRECATED;
504 operator QVariant()
const
506 return QVariant::fromValue( *
this );
514 int idx = ( int )sipConvertFromSequenceIndex( a0, sipCpp->count() );
518 ( *sipCpp )[idx] = *a1;
528 class const_iterator;
534 typedef std::random_access_iterator_tag iterator_category;
535 typedef qptrdiff difference_type;
545 inline QgsField *operator->()
const {
return &d->
field; }
546 inline QgsField &operator[]( difference_type j )
const {
return d[j].
field; }
547 inline bool operator==(
const iterator &o )
const noexcept {
return d == o.d; }
548 inline bool operator!=(
const iterator &o )
const noexcept {
return d != o.d; }
549 inline bool operator<(
const iterator &other )
const noexcept {
return d < other.d; }
550 inline bool operator<=(
const iterator &other )
const noexcept {
return d <= other.d; }
551 inline bool operator>(
const iterator &other )
const noexcept {
return d > other.d; }
552 inline bool operator>=(
const iterator &other )
const noexcept {
return d >= other.d; }
554 inline iterator &operator++() { ++d;
return *
this; }
555 inline iterator operator++(
int ) {
QgsFields::Field *n = d; ++d;
return n; }
556 inline iterator &operator--() { d--;
return *
this; }
557 inline iterator operator--(
int ) {
QgsFields::Field *n = d; d--;
return n; }
558 inline iterator &operator+=( difference_type j ) { d += j;
return *
this; }
559 inline iterator &operator-=( difference_type j ) { d -= j;
return *
this; }
560 inline iterator
operator+( difference_type j )
const {
return iterator( d + j ); }
561 inline iterator
operator-( difference_type j )
const {
return iterator( d - j ); }
562 inline int operator-( iterator j )
const {
return int( d - j.d ); }
564 friend class iterator;
571 typedef std::random_access_iterator_tag iterator_category;
572 typedef qptrdiff difference_type;
574 inline const_iterator()
579 inline const_iterator(
const const_iterator &o )
581 inline explicit const_iterator(
const iterator &o )
584 inline const QgsField *operator->()
const {
return &d->
field; }
585 inline const QgsField &operator[]( difference_type j )
const noexcept {
return d[j].
field; }
586 inline bool operator==(
const const_iterator &o )
const noexcept {
return d == o.d; }
587 inline bool operator!=(
const const_iterator &o )
const noexcept {
return d != o.d; }
588 inline bool operator<(
const const_iterator &other )
const noexcept {
return d < other.d; }
589 inline bool operator<=(
const const_iterator &other )
const noexcept {
return d <= other.d; }
590 inline bool operator>(
const const_iterator &other )
const noexcept {
return d > other.d; }
591 inline bool operator>=(
const const_iterator &other )
const noexcept {
return d >= other.d; }
592 inline const_iterator &operator++() { ++d;
return *
this; }
593 inline const_iterator operator++(
int ) {
const QgsFields::Field *n = d; ++d;
return n; }
594 inline const_iterator &operator--() { d--;
return *
this; }
595 inline const_iterator operator--(
int ) {
const QgsFields::Field *n = d; --d;
return n; }
596 inline const_iterator &operator+=( difference_type j ) { d += j;
return *
this; }
597 inline const_iterator &operator-=( difference_type j ) { d -= j;
return *
this; }
598 inline const_iterator
operator+( difference_type j )
const {
return const_iterator( d + j ); }
599 inline const_iterator
operator-( difference_type j )
const {
return const_iterator( d - j ); }
600 inline int operator-( const_iterator j )
const {
return int( d - j.d ); }
602 const_iterator &operator= (
const const_iterator & ) =
delete;
604 friend class const_iterator;
613 const_iterator constBegin() const noexcept;
620 const_iterator constEnd() const noexcept;
627 const_iterator begin() const noexcept;
634 const_iterator end() const noexcept;
655 QSharedDataPointer<QgsFieldsPrivate> d;