53 : QAbstractTableModel( parent )
54 , mLayer( layerCache->layer() )
55 , mLayerCache( layerCache )
64 mFeat.
setId( std::numeric_limits<int>::min() );
79 mIsCleaningUpAfterRollback =
true;
80 bulkEditCommandEnded();
81 mIsCleaningUpAfterRollback =
false;
90bool QgsAttributeTableModel::loadFeatureAtId(
QgsFeatureId fid )
const
94 if ( fid == std::numeric_limits<int>::min() )
104 return mExtraColumns;
113void QgsAttributeTableModel::featuresDeleted(
const QgsFeatureIds &fids )
117 const auto constFids = fids;
120 QgsDebugMsgLevel( QStringLiteral(
"(%2) fid: %1, size: %3" ).arg( fid ).arg( mFeatureRequest.
filterType() ).arg( mIdRowMap.size() ), 4 );
122 const int row =
idToRow( fid );
127 std::sort( rows.begin(), rows.end() );
131 int currentRowCount = 0;
135 const auto constRows = rows;
136 for (
const int row : constRows )
139 qDebug() <<
"Row: " << row <<
", begin " << beginRow <<
", last " << lastRow <<
", current " << currentRowCount <<
", removed " << removedRows;
146 if ( row != lastRow + 1 && lastRow != -1 )
148 if ( rows.count() > 100 && currentRowCount < 10 )
153 removeRows( beginRow - removedRows, currentRowCount );
156 removedRows += currentRowCount;
166 removeRows( beginRow - removedRows, currentRowCount );
174 if ( row < 0 || count < 1 )
177 if ( !mResettingModel )
179 beginRemoveRows( parent, row, row + count - 1 );
184 QgsDebugMsgLevel( QStringLiteral(
"remove %2 rows at %1 (rows %3, ids %4)" ).arg( row ).arg( count ).arg( mRowIdMap.size() ).arg( mIdRowMap.size() ), 3 );
187 if ( mBulkEditCommandRunning && !mResettingModel )
189 for (
int i = row; i < row + count; i++ )
192 mInsertedRowsChanges.removeOne( fid );
197 for (
int i = row; i < row + count; i++ )
199 for ( SortCache &cache : mSortCaches )
200 cache.sortCache.remove( mRowIdMap[i] );
201 mIdRowMap.remove( mRowIdMap[i] );
202 mRowIdMap.remove( i );
206 const int n = mRowIdMap.size() + count;
207 for (
int i = row + count; i < n; i++ )
210 mIdRowMap[id] -= count;
211 mRowIdMap[i - count] = id;
212 mRowIdMap.remove( i );
218 QgsDebugMsgLevel( QStringLiteral(
"after removal rows %1, ids %2" ).arg( mRowIdMap.size() ).arg( mIdRowMap.size() ), 4 );
220 for ( QHash<QgsFeatureId, int>::const_iterator it = mIdRowMap.constBegin(); it != mIdRowMap.constEnd(); ++it )
224 for ( QHash<int, QgsFeatureId>::const_iterator it = mRowIdMap.constBegin(); it != mRowIdMap.constEnd(); ++it )
229 Q_ASSERT( mRowIdMap.size() == mIdRowMap.size() );
231 if ( !mResettingModel )
237void QgsAttributeTableModel::featureAdded(
QgsFeatureId fid )
242 if ( mFeat.
id() != fid )
243 featOk = loadFeatureAtId( fid );
247 for ( SortCache &cache : mSortCaches )
249 if ( cache.sortFieldIndex >= 0 )
252 const QVariant &widgetCache = mAttributeWidgetCaches.at( cache.sortFieldIndex );
253 const QVariantMap &widgetConfig = mWidgetConfigs.at( cache.sortFieldIndex );
254 const QVariant sortValue = fieldFormatter->
sortValue( mLayer, cache.sortFieldIndex, widgetConfig, widgetCache, mFeat.
attribute( cache.sortFieldIndex ) );
255 cache.sortCache.insert( mFeat.
id(), sortValue );
257 else if ( cache.sortCacheExpression.isValid() )
260 cache.sortCache[mFeat.
id()] = cache.sortCacheExpression.evaluate( &mExpressionContext );
265 if ( ! mIdRowMap.contains( fid ) )
267 const int n = mRowIdMap.size();
268 if ( !mResettingModel )
269 beginInsertRows( QModelIndex(), n, n );
270 mIdRowMap.insert( fid, n );
271 mRowIdMap.insert( n, fid );
272 if ( !mResettingModel )
275 if ( mBulkEditCommandRunning && !mResettingModel )
277 mInsertedRowsChanges.append( fid );
283void QgsAttributeTableModel::updatedFields()
289void QgsAttributeTableModel::editCommandEnded()
293 bulkEditCommandEnded( );
296void QgsAttributeTableModel::attributeDeleted(
int idx )
299 for (
const SortCache &cache : mSortCaches )
301 if ( cache.sortCacheAttributes.contains( idx ) )
309void QgsAttributeTableModel::layerDeleted()
311 mLayerCache =
nullptr;
315 mAttributeWidgetCaches.clear();
317 mWidgetFactories.clear();
318 mWidgetConfigs.clear();
319 mFieldFormatters.clear();
322void QgsAttributeTableModel::fieldFormatterRemoved(
QgsFieldFormatter *fieldFormatter )
324 for (
int i = 0; i < mFieldFormatters.size(); ++i )
326 if ( mFieldFormatters.at( i ) == fieldFormatter )
331void QgsAttributeTableModel::attributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant &value )
334 if ( mBulkEditCommandRunning )
336 mAttributeValueChanges.insert( QPair<QgsFeatureId, int>( fid, idx ), value );
339 QgsDebugMsgLevel( QStringLiteral(
"(%4) fid: %1, idx: %2, value: %3" ).arg( fid ).arg( idx ).arg( value.toString() ).arg( mFeatureRequest.
filterType() ), 2 );
341 for ( SortCache &cache : mSortCaches )
343 if ( cache.sortCacheAttributes.contains( idx ) )
345 if ( cache.sortFieldIndex == -1 )
347 if ( loadFeatureAtId( fid ) )
350 cache.sortCache[fid] = cache.sortCacheExpression.evaluate( &mExpressionContext );
356 const QVariant &widgetCache = mAttributeWidgetCaches.at( cache.sortFieldIndex );
357 const QVariantMap &widgetConfig = mWidgetConfigs.at( cache.sortFieldIndex );
358 const QVariant sortValue = fieldFormatter->
representValue( mLayer, cache.sortFieldIndex, widgetConfig, widgetCache, value );
359 cache.sortCache.insert( fid, sortValue );
366 if ( loadFeatureAtId( fid ) )
371 if ( loadFeatureAtId( fid ) )
375 if ( !mIdRowMap.contains( fid ) )
388 if ( mIdRowMap.contains( fid ) )
399void QgsAttributeTableModel::loadAttributes()
406 bool ins =
false, rm =
false;
411 mWidgetFactories.clear();
412 mAttributeWidgetCaches.clear();
413 mWidgetConfigs.clear();
414 mFieldFormatters.clear();
416 for (
int idx = 0; idx < fields.
count(); ++idx )
422 mWidgetFactories.append( widgetFactory );
423 mWidgetConfigs.append( setup.
config() );
424 mAttributeWidgetCaches.append( fieldFormatter->
createCache( mLayer, idx, setup.
config() ) );
425 mFieldFormatters.append( fieldFormatter );
430 if ( mFieldCount + mExtraColumns < attributes.size() + mExtraColumns )
433 beginInsertColumns( QModelIndex(), mFieldCount + mExtraColumns, attributes.size() - 1 );
435 else if ( attributes.size() + mExtraColumns < mFieldCount + mExtraColumns )
438 beginRemoveColumns( QModelIndex(), attributes.size(), mFieldCount + mExtraColumns - 1 );
441 mFieldCount = attributes.size();
442 mAttributes = attributes;
444 for ( SortCache &cache : mSortCaches )
446 if ( cache.sortFieldIndex >= mAttributes.count() )
447 cache.sortFieldIndex = -1;
469 mResettingModel =
true;
491 if ( t.elapsed() > 1000 )
500 featureAdded( mFeat.
id() );
509 mResettingModel =
false;
515 if ( fieldName.isNull() )
517 mRowStylesMap.clear();
523 if ( fieldIndex == -1 )
527 const int col =
fieldCol( fieldIndex );
528 emit dataChanged( index( 0, col ), index(
rowCount() - 1, col ) );
541 mRowIdMap.remove( rowA );
542 mRowIdMap.remove( rowB );
543 mRowIdMap.insert( rowA, b );
544 mRowIdMap.insert( rowB, a );
546 mIdRowMap.remove( a );
547 mIdRowMap.remove( b );
548 mIdRowMap.insert( a, rowB );
549 mIdRowMap.insert( b, rowA );
550 Q_ASSERT( mRowIdMap.size() == mIdRowMap.size() );
558 if ( !mIdRowMap.contains(
id ) )
560 QgsDebugMsg( QStringLiteral(
"idToRow: id %1 not in the map" ).arg(
id ) );
564 return mIdRowMap[id];
569 return index(
idToRow(
id ), 0 );
574 QModelIndexList indexes;
578 indexes.reserve( columns );
579 for (
int column = 0; column < columns; ++column )
581 indexes.append( index( row, column ) );
589 if ( !mRowIdMap.contains( row ) )
591 QgsDebugMsg( QStringLiteral(
"rowToId: row %1 not in the map" ).arg( row ) );
593 return std::numeric_limits<int>::min();
596 return mRowIdMap[row];
601 return mAttributes[col];
606 return mAttributes.indexOf( idx );
612 return mRowIdMap.size();
618 return std::max( 1, mFieldCount + mExtraColumns );
626 if ( role == Qt::DisplayRole )
628 if ( orientation == Qt::Vertical )
630 return QVariant( section );
632 else if ( section >= 0 && section < mFieldCount )
634 const QString attributeName = mLayer->
fields().
at( mAttributes.at( section ) ).
displayName();
635 return QVariant( attributeName );
639 return tr(
"extra column" );
642 else if ( role == Qt::ToolTipRole )
644 if ( orientation == Qt::Vertical )
647 return tr(
"Feature ID: %1" ).arg(
rowToId( section ) );
663 if ( !index.isValid() || !mLayer ||
664 ( role != Qt::TextAlignmentRole
665 && role != Qt::DisplayRole
666 && role != Qt::ToolTipRole
667 && role != Qt::EditRole
670 && role != Qt::BackgroundRole
671 && role != Qt::ForegroundRole
672 && role != Qt::DecorationRole
673 && role != Qt::FontRole
684 if ( index.column() >= mFieldCount )
687 const int fieldId = mAttributes.at( index.column() );
694 const unsigned long cacheIndex = role -
SortRole;
695 if ( cacheIndex < mSortCaches.size() )
696 return mSortCaches.at( cacheIndex ).sortCache.value( rowId );
703 if ( role == Qt::TextAlignmentRole )
705 return static_cast<Qt::Alignment::Int
>( mFieldFormatters.at( index.column() )->alignmentFlag( mLayer, fieldId, mWidgetConfigs.at( index.column() ) ) | Qt::AlignVCenter );
708 if ( mFeat.
id() != rowId || !mFeat.
isValid() )
710 if ( !loadFeatureAtId( rowId ) )
711 return QVariant(
"ERROR" );
713 if ( mFeat.
id() != rowId )
714 return QVariant(
"ERROR" );
717 QVariant val = mFeat.
attribute( fieldId );
721 case Qt::DisplayRole:
722 return mFieldFormatters.at( index.column() )->representValue( mLayer,
724 mWidgetConfigs.at( index.column() ),
725 mAttributeWidgetCaches.at( index.column() ),
727 case Qt::ToolTipRole:
729 QString tooltip = mFieldFormatters.at( index.column() )->representValue( mLayer,
731 mWidgetConfigs.at( index.column() ),
732 mAttributeWidgetCaches.at( index.column() ),
736 tooltip = tr(
"%1 (Ctrl+click to open)" ).arg( tooltip );
743 case Qt::BackgroundRole:
744 case Qt::ForegroundRole:
745 case Qt::DecorationRole:
749 QList<QgsConditionalStyle> styles;
750 if ( mRowStylesMap.contains( mFeat.
id() ) )
752 styles = mRowStylesMap[mFeat.
id()];
757 mRowStylesMap.insert( mFeat.
id(), styles );
763 styles.insert( 0, rowstyle );
770 if ( role == Qt::ForegroundRole )
772 if ( role == Qt::DecorationRole )
774 if ( role == Qt::FontRole )
779 if ( role == Qt::ForegroundRole )
781 return QColor( Qt::blue );
783 else if ( role == Qt::FontRole )
786 font.setUnderline(
true );
802 if ( !index.isValid() || index.column() >= mFieldCount || role != Qt::EditRole || !mLayer->
isEditable() )
805 mRowStylesMap.remove( mFeat.
id() );
815 if ( !index.isValid() )
816 return Qt::ItemIsEnabled;
818 if ( index.column() >= mFieldCount || !mLayer )
819 return Qt::NoItemFlags;
821 Qt::ItemFlags
flags = QAbstractTableModel::flags( index );
823 const int fieldIndex = mAttributes[index.column()];
827 flags |= Qt::ItemIsEditable;
832void QgsAttributeTableModel::bulkEditCommandStarted()
834 mBulkEditCommandRunning =
true;
835 mAttributeValueChanges.clear();
838void QgsAttributeTableModel::bulkEditCommandEnded()
840 mBulkEditCommandRunning =
false;
843 const int changeCount( std::max( mAttributeValueChanges.count(), mInsertedRowsChanges.count() ) );
844 const bool fullModelUpdate = changeCount > mLayerCache->
cacheSize() ||
847 QgsDebugMsgLevel( QStringLiteral(
"Bulk edit command ended with %1 modified rows over (%4), cache size is %2, starting %3 update." )
850 .arg( fullModelUpdate ? QStringLiteral(
"full" ) : QStringLiteral(
"incremental" ) )
855 if ( mIsCleaningUpAfterRollback )
857 for (
const int fid : std::as_const( mInsertedRowsChanges ) )
859 const int row(
idToRow( fid ) );
869 if ( fullModelUpdate )
882 const auto keys = mAttributeValueChanges.keys();
883 for (
const auto &key : keys )
885 attributeValueChanged( key.first, key.second, mAttributeValueChanges.value( key ) );
886 const int row(
idToRow( key.first ) );
887 const int col(
fieldCol( key.second ) );
888 minRow = std::min<int>( row, minRow );
889 minCol = std::min<int>( col, minCol );
890 maxRow = std::max<int>( row, maxRow );
891 maxCol = std::max<int>( col, maxCol );
894 emit dataChanged( createIndex( minRow, minCol ), createIndex( maxRow, maxCol ) );
896 mAttributeValueChanges.clear();
901 mFeat.
setId( std::numeric_limits<int>::min() );
902 emit dataChanged( index1, index2 );
923 for (
int i = 0; i < mAttributes.size(); i++ )
925 f.
setAttribute( mAttributes[i],
data( index( idx.row(), i ), Qt::EditRole ) );
933 if ( column == -1 || column >= mAttributes.count() )
945 if ( cacheIndex >= mSortCaches.size() )
947 mSortCaches.resize( cacheIndex + 1 );
949 SortCache &cache = mSortCaches[cacheIndex];
950 cache.sortCache.clear();
951 cache.sortCacheAttributes.clear();
952 cache.sortFieldIndex = -1;
953 if ( !expressionString.isEmpty() )
954 cache.sortCacheExpression =
QgsExpression( expressionString );
963 QVariant widgetCache;
964 QVariantMap widgetConfig;
966 if ( cache.sortCacheExpression.isField() )
972 if ( cache.sortFieldIndex == -1 )
974 cache.sortCacheExpression.prepare( &mExpressionContext );
976 const QSet<QString> &referencedColumns = cache.sortCacheExpression.referencedColumns();
978 for (
const QString &col : referencedColumns )
985 cache.sortCacheAttributes.append( cache.sortFieldIndex );
987 widgetCache = mAttributeWidgetCaches.at( cache.sortFieldIndex );
988 widgetConfig = mWidgetConfigs.at( cache.sortFieldIndex );
989 fieldFormatter = mFieldFormatters.at( cache.sortFieldIndex );
1000 if ( cache.sortFieldIndex == -1 )
1003 const QVariant cacheValue = cache.sortCacheExpression.evaluate( &mExpressionContext );
1004 cache.sortCache.insert( f.
id(), cacheValue );
1008 const QVariant sortValue = fieldFormatter->
sortValue( mLayer, cache.sortFieldIndex, widgetConfig, widgetCache, f.
attribute( cache.sortFieldIndex ) );
1009 cache.sortCache.insert( f.
id(), sortValue );
1016 QString expressionString;
1018 if ( cacheIndex >= mSortCaches.size() )
1019 return expressionString;
1021 const QgsExpression &expression = mSortCaches[cacheIndex].sortCacheExpression;
1026 expressionString = QString();
1028 return expressionString;
1040 return mFeatureRequest;
void doAction(QUuid actionId, const QgsFeature &feature, int defaultValueIndex=0, const QgsExpressionContextScope &scope=QgsExpressionContextScope())
Does the given action.
static QgsFieldFormatterRegistry * fieldFormatterRegistry()
Gets the registry of available field formatters.
const QgsFeatureRequest & request() const
Gets the the feature request.
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
Remove rows.
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns item flags for the index.
QgsFeature feature(const QModelIndex &idx) const
Returns the feature attributes at given model index.
void resetModel()
Resets the model.
void fieldConditionalStyleChanged(const QString &fieldName)
Handles updating the model when the conditional style for a field changes.
QString sortCacheExpression(unsigned long cacheIndex=0) const
The expression which was used to fill the sorting cache at index cacheIndex.
int fieldIdx(int col) const
Gets field index from column.
QgsAttributeTableModel(QgsVectorLayerCache *layerCache, QObject *parent=nullptr)
Constructor.
void swapRows(QgsFeatureId a, QgsFeatureId b)
Swaps two rows.
void modelChanged()
Model has been changed.
void progress(int i, bool &cancel)
void setRequest(const QgsFeatureRequest &request)
Set a request that will be used to fill this attribute table model.
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Updates data on given index.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows.
QModelIndex idToIndex(QgsFeatureId id) const
int extraColumns() const
Empty extra columns to announce from this model.
void executeMapLayerAction(QgsMapLayerAction *action, const QModelIndex &idx) const
Execute a QgsMapLayerAction.
QgsVectorLayerCache * layerCache() const
Returns the layer cache this model uses as backend.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Returns header data.
QModelIndexList idToIndexList(QgsFeatureId id) const
void prefetchSortData(const QString &expression, unsigned long cacheIndex=0)
Prefetches the entire data for an expression.
QgsFeatureId rowToId(int row) const
Maps row to feature id.
int idToRow(QgsFeatureId id) const
Maps feature id to table row.
virtual void loadLayer()
Loads the layer into the model Preferably to be called, before using this model as source for any oth...
@ SortRole
Role used for sorting start here.
@ FeatureIdRole
Get the feature id of the feature in this row.
@ FieldIndexRole
Get the field index of this column.
void setExtraColumns(int extraColumns)
Empty extra columns to announce from this model.
void prefetchColumnData(int column)
Caches the entire data for one column.
int fieldCol(int idx) const
Gets column from field index.
void reload(const QModelIndex &index1, const QModelIndex &index2)
Reloads the model data between indices.
void executeAction(QUuid action, const QModelIndex &idx) const
Execute an action.
QVariant data(const QModelIndex &index, int role) const override
Returns data on the given index.
QgsConditionalStyles rowStyles() const
Returns a list of row styles associated with the layer.
QList< QgsConditionalStyle > fieldStyles(const QString &fieldName) const
Returns the conditional styles set for the field with matching fieldName.
Conditional styling for a rule.
static QgsConditionalStyle compressStyles(const QList< QgsConditionalStyle > &styles)
Compress a list of styles into a single style.
static QList< QgsConditionalStyle > matchingConditionalStyles(const QList< QgsConditionalStyle > &styles, const QVariant &value, QgsExpressionContext &context)
Find and return the matching styles for the value and feature.
QColor backgroundColor() const
The background color for style.
QColor textColor() const
The text color set for style.
QFont font() const
The font for the style.
bool isValid() const
isValid Check if this rule is valid.
QPixmap icon() const
The icon set for style generated from the set symbol.
bool validBackgroundColor() const
Check if the background color is valid for render.
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
void appendScopes(const QList< QgsExpressionContextScope * > &scopes)
Appends a list of scopes to the end of the context.
An expression node which takes it value from a feature's field.
Class for parsing and evaluation of expressions (formerly called "search strings").
QString expression() const
Returns the original, unmodified expression string.
static QString quotedColumnRef(QString name)
Returns a quoted column reference (in double quotes)
bool isValid() const
Checks if this expression is valid.
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
This class wraps a request for features to a vector layer (or directly its vector data provider).
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.
Flags flags() const
Returns the flags which affect how features are fetched.
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
@ NoGeometry
Geometry is not required. It may still be returned if e.g. required for a filter condition.
bool acceptFeature(const QgsFeature &feature)
Check if a feature is accepted by this requests filter.
FilterType filterType() const
Returns the attribute/ID filter type which is currently set on this request.
@ FilterNone
No filter is applied.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
bool setAttribute(int field, const QVariant &attr)
Sets an attribute's value by field index.
void initAttributes(int fieldCount)
Initialize this feature with the given number of fields.
void setId(QgsFeatureId id)
Sets the feature id for this feature.
bool isValid() const
Returns the validity of this feature.
QVariant attribute(const QString &name) const
Lookup attribute value by attribute name.
static QString fieldToolTipExtended(const QgsField &field, const QgsVectorLayer *layer)
Returns a HTML formatted tooltip string for a field, containing details like the field name,...
Encapsulate a field in an attribute table or data source.
QString displayName() const
Returns the name to use when displaying this field.
Container of fields for a vector layer.
int count() const
Returns number of items.
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
static QgsEditorWidgetRegistry * editorWidgetRegistry()
Returns the global editor widget registry, used for managing all known edit widget factories.
static int debugLevel()
Reads the environment variable QGIS_DEBUG and converts it to int.
An action which can run on map layers The class can be used in two manners:
virtual void triggerForFeature(QgsMapLayer *layer, const QgsFeature &feature)
Triggers the action with the specified layer and feature.
void dataChanged()
Data of layer changed.
static bool isUrl(const QString &string)
Returns whether the string is a URL (http,https,ftp,file)
This class caches features of a given QgsVectorLayer.
void invalidated()
The cache has been invalidated and cleared.
void featureAdded(QgsFeatureId fid)
Emitted when a new feature has been added to the layer and this cache.
void cachedLayerDeleted()
Is emitted when the cached layer is deleted.
void attributeValueChanged(QgsFeatureId fid, int field, const QVariant &value)
Emitted when an attribute is changed.
QgsVectorLayer * layer()
Returns the layer to which this cache belongs.
int cacheSize()
Returns the maximum number of features this cache will hold.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &featureRequest=QgsFeatureRequest())
Query this VectorLayerCache for features.
bool featureAtId(QgsFeatureId featureId, QgsFeature &feature, bool skipCache=false)
Gets the feature at the given feature id.
static bool fieldIsEditable(const QgsVectorLayer *layer, int fieldIndex, const QgsFeature &feature)
Tests whether a field is editable for a particular feature.
bool isModified() const override
Returns true if the provider has been modified since the last commit.
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
void editCommandStarted(const QString &text)
Signal emitted when a new edit command has been started.
bool isSpatial() const FINAL
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeome...
QgsFields fields() const FINAL
Returns the list of fields of this layer.
void featuresDeleted(const QgsFeatureIds &fids)
Emitted when features have been deleted.
bool isEditable() const FINAL
Returns true if the provider is in editing mode.
void attributeDeleted(int idx)
Will be emitted, when an attribute has been deleted from this vector layer.
QgsActionManager * actions()
Returns all layer actions defined on this layer.
void editCommandEnded()
Signal emitted, when an edit command successfully ended.
void afterRollBack()
Emitted after changes are rolled back.
void updatedFields()
Emitted whenever the fields available from this layer have been changed.
QgsConditionalLayerStyles * conditionalStyles() const
Returns the conditional styles that are set for this layer.
void beforeRollBack()
Emitted before changes are rolled back.
QSet< QgsFeatureId > QgsFeatureIds
#define FID_TO_STRING(fid)
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
QList< int > QgsAttributeList
#define QgsDebugMsgLevel(str, level)