QGIS API Documentation  2.99.0-Master (13a3f2f)
qgsattributetablefiltermodel.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  QgsAttributeTableFilterModel.cpp
3  --------------------------------------
4  Date : Feb 2009
5  Copyright : (C) 2009 Vita Cizek
6  Email : weetya (at) gmail.com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include <QItemSelectionModel>
17 
18 #include "qgis.h"
20 #include "qgsattributetablemodel.h"
21 #include "qgsfeatureiterator.h"
22 #include "qgsvectorlayer.h"
23 #include "qgsfeature.h"
24 #include "qgsmapcanvas.h"
25 #include "qgslogger.h"
26 #include "qgsrenderer.h"
29 // Filter Model //
31 
33  : QSortFilterProxyModel( parent )
34  , mCanvas( canvas )
35  , mFilterMode( ShowAll )
36  , mSelectedOnTop( false )
37 {
38  setSourceModel( sourceModel );
39  setDynamicSortFilter( true );
40  setSortRole( QgsAttributeTableModel::SortRole );
41  connect( layer(), &QgsVectorLayer::selectionChanged, this, &QgsAttributeTableFilterModel::selectionChanged );
42 }
43 
44 bool QgsAttributeTableFilterModel::lessThan( const QModelIndex &left, const QModelIndex &right ) const
45 {
46  if ( mSelectedOnTop )
47  {
48  bool leftSelected = layer()->selectedFeatureIds().contains( masterModel()->rowToId( left.row() ) );
49  bool rightSelected = layer()->selectedFeatureIds().contains( masterModel()->rowToId( right.row() ) );
50 
51  if ( leftSelected && !rightSelected )
52  {
53  return sortOrder() == Qt::AscendingOrder;
54  }
55  else if ( rightSelected && !leftSelected )
56  {
57  return sortOrder() == Qt::DescendingOrder;
58  }
59  }
60 
61  if ( mTableModel->sortCacheExpression().isEmpty() )
62  {
63  //shortcut when no sort order set
64  return false;
65  }
66 
68  right.data( QgsAttributeTableModel::SortRole ) );
69 }
70 
71 void QgsAttributeTableFilterModel::sort( int column, Qt::SortOrder order )
72 {
73  if ( order != Qt::AscendingOrder && order != Qt::DescendingOrder )
74  order = Qt::AscendingOrder;
75 
76  int myColumn = mColumnMapping.at( column );
77  masterModel()->prefetchColumnData( myColumn );
78  QSortFilterProxyModel::sort( myColumn, order );
79  emit sortColumnChanged( column, order );
80 }
81 
82 QVariant QgsAttributeTableFilterModel::data( const QModelIndex &index, int role ) const
83 {
84  if ( mapColumnToSource( index.column() ) == -1 ) // actions
85  {
86  if ( role == TypeRole )
88  else if ( role == QgsAttributeTableModel::FeatureIdRole )
89  {
90  QModelIndex fieldIndex = QSortFilterProxyModel::mapToSource( QSortFilterProxyModel::index( index.row(), 0, index.parent() ) );
91  return sourceModel()->data( fieldIndex, QgsAttributeTableModel::FeatureIdRole );
92  }
93  }
94  else if ( role == TypeRole )
95  return ColumnTypeField;
96 
97  return QSortFilterProxyModel::data( index, role );
98 }
99 
100 QVariant QgsAttributeTableFilterModel::headerData( int section, Qt::Orientation orientation, int role ) const
101 {
102  if ( orientation == Qt::Horizontal )
103  {
104  if ( mColumnMapping.at( section ) == -1 && role == Qt::DisplayRole )
105  return tr( "Actions" );
106  else
107  return QSortFilterProxyModel::headerData( section, orientation, role );
108  }
109  else
110  {
111  if ( role == Qt::DisplayRole )
112  return section + 1;
113  else
114  {
115  int sourceSection = mapToSource( index( section, ( !mColumnMapping.isEmpty() && mColumnMapping.at( 0 ) == -1 ) ? 1 : 0 ) ).row();
116  return sourceModel()->headerData( sourceSection, orientation, role );
117  }
118  }
119 }
120 
122 {
123  return mColumnMapping.indexOf( -1 );
124 }
125 
126 int QgsAttributeTableFilterModel::columnCount( const QModelIndex &parent ) const
127 {
128  Q_UNUSED( parent );
129  return mColumnMapping.count();
130 }
131 
133 {
134  mConfig = config;
135  mConfig.update( layer()->fields() );
136 
137  QVector<int> newColumnMapping;
138 
139  Q_FOREACH ( const QgsAttributeTableConfig::ColumnConfig &columnConfig, mConfig.columns() )
140  {
141  // Hidden? Forget about this column
142  if ( columnConfig.hidden )
143  continue;
144 
145  // The new value for the mapping (field index or -1 for action column)
146  int newValue = ( columnConfig.type == QgsAttributeTableConfig::Action ) ? -1 : layer()->fields().lookupField( columnConfig.name );
147  newColumnMapping << newValue;
148  }
149 
150  if ( newColumnMapping != mColumnMapping )
151  {
152  bool requiresReset = false;
153  int firstRemovedColumn = -1;
154  int removedColumnCount = 0;
155 
156  // Check if there have a contiguous set of columns have been removed or if we require a full reset
157  for ( int i = 0; i < qMin( newColumnMapping.size(), mColumnMapping.size() - removedColumnCount ); ++i )
158  {
159  if ( newColumnMapping.at( i ) == mColumnMapping.at( i + removedColumnCount ) )
160  continue;
161 
162  if ( firstRemovedColumn == -1 )
163  {
164  firstRemovedColumn = i;
165 
166  while ( i < mColumnMapping.size() - removedColumnCount && mColumnMapping.at( i + removedColumnCount ) != newColumnMapping.at( i ) )
167  {
168  ++removedColumnCount;
169  }
170  }
171  else
172  {
173  requiresReset = true;
174  break;
175  }
176  }
177 
178  // No difference found so far
179  if ( firstRemovedColumn == -1 )
180  {
181  if ( newColumnMapping.size() > mColumnMapping.size() )
182  {
183  // More columns: appended to the end
184  beginInsertColumns( QModelIndex(), mColumnMapping.size(), newColumnMapping.size() - 1 );
185  mColumnMapping = newColumnMapping;
186  endInsertColumns();
187  }
188  else
189  {
190  // Less columns: removed from the end
191  beginRemoveColumns( QModelIndex(), newColumnMapping.size(), mColumnMapping.size() - 1 );
192  mColumnMapping = newColumnMapping;
193  endRemoveColumns();
194  }
195  }
196  else
197  {
198  if ( newColumnMapping.size() == mColumnMapping.size() - removedColumnCount )
199  {
200  beginRemoveColumns( QModelIndex(), firstRemovedColumn, firstRemovedColumn );
201  mColumnMapping = newColumnMapping;
202  endRemoveColumns();
203  }
204  else
205  {
206  requiresReset = true;
207  }
208  }
209 
210  if ( requiresReset )
211  {
212  beginResetModel();
213  mColumnMapping = newColumnMapping;
214  endResetModel();
215  }
216  }
217 
218  if ( !config.sortExpression().isEmpty() )
219  sort( config.sortExpression(), config.sortOrder() );
220 }
221 
222 void QgsAttributeTableFilterModel::sort( const QString &expression, Qt::SortOrder order )
223 {
224  if ( order != Qt::AscendingOrder && order != Qt::DescendingOrder )
225  order = Qt::AscendingOrder;
226 
227  QSortFilterProxyModel::sort( -1 );
228  masterModel()->prefetchSortData( expression );
229  QSortFilterProxyModel::sort( 0, order ) ;
230 }
231 
233 {
234  return masterModel()->sortCacheExpression();
235 }
236 
238 {
239  if ( mSelectedOnTop != selectedOnTop )
240  {
241  mSelectedOnTop = selectedOnTop;
242  int column = sortColumn();
243  Qt::SortOrder order = sortOrder();
244 
245  // set default sort values if they are not correctly set
246  if ( column < 0 )
247  column = 0;
248 
249  if ( order != Qt::AscendingOrder && order != Qt::DescendingOrder )
250  order = Qt::AscendingOrder;
251 
252  sort( column, order );
253  invalidate();
254  }
255 }
256 
258 {
259  mTableModel = sourceModel;
260 
261  for ( int i = 0; i < mTableModel->columnCount() - mTableModel->extraColumns(); ++i )
262  {
263  mColumnMapping.append( i );
264  }
265 
266  QSortFilterProxyModel::setSourceModel( sourceModel );
267 
268  // Disconnect any code to update columns in the parent, we handle this manually
269  disconnect( mTableModel, SIGNAL( columnsAboutToBeInserted( QModelIndex, int, int ) ), this, SLOT( _q_sourceColumnsAboutToBeInserted( QModelIndex, int, int ) ) );
270  disconnect( mTableModel, SIGNAL( columnsInserted( QModelIndex, int, int ) ), this, SLOT( _q_sourceColumnsInserted( QModelIndex, int, int ) ) );
271  disconnect( mTableModel, SIGNAL( columnsAboutToBeRemoved( QModelIndex, int, int ) ), this, SLOT( _q_sourceColumnsAboutToBeRemoved( QModelIndex, int, int ) ) );
272  disconnect( mTableModel, SIGNAL( columnsRemoved( QModelIndex, int, int ) ), this, SLOT( _q_sourceColumnsRemoved( QModelIndex, int, int ) ) );
273  // The following connections are needed in order to keep the filter model in sync, see: regression #15974
274  connect( mTableModel, &QAbstractItemModel::columnsAboutToBeInserted, this, &QgsAttributeTableFilterModel::onColumnsChanged );
275  connect( mTableModel, &QAbstractItemModel::columnsAboutToBeRemoved, this, &QgsAttributeTableFilterModel::onColumnsChanged );
276 
277 }
278 
280 {
281  return mSelectedOnTop;
282 }
283 
285 {
286  mFilteredFeatures = ids;
288  invalidateFilter();
289 }
290 
292 {
293  QgsFeatureIds ids;
294  ids.reserve( rowCount() );
295  for ( int i = 0; i < rowCount(); ++i )
296  {
297  QModelIndex row = index( i, 0 );
298  ids << rowToId( row );
299  }
300  return ids;
301 }
302 
304 {
305  if ( filterMode != mFilterMode )
306  {
307  if ( filterMode == ShowVisible )
308  {
311  }
312  else
313  {
315  }
316 
317  mFilterMode = filterMode;
318  invalidateFilter();
319  }
320 }
321 
322 bool QgsAttributeTableFilterModel::filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const
323 {
324  Q_UNUSED( sourceParent );
325  switch ( mFilterMode )
326  {
327  case ShowAll:
328  return true;
329 
330  case ShowFilteredList:
331  return mFilteredFeatures.contains( masterModel()->rowToId( sourceRow ) );
332 
333  case ShowSelected:
334  return layer()->selectedFeatureIds().contains( masterModel()->rowToId( sourceRow ) );
335 
336  case ShowVisible:
337  return mFilteredFeatures.contains( masterModel()->rowToId( sourceRow ) );
338 
339  case ShowEdited:
340  {
341  QgsVectorLayerEditBuffer *editBuffer = layer()->editBuffer();
342  if ( editBuffer )
343  {
344  QgsFeatureId fid = masterModel()->rowToId( sourceRow );
345 
346  if ( editBuffer->isFeatureAdded( fid ) )
347  return true;
348 
349  if ( editBuffer->isFeatureAttributesChanged( fid ) )
350  return true;
351 
352  if ( editBuffer->isFeatureGeometryChanged( fid ) )
353  return true;
354 
355  return false;
356  }
357  return false;
358  }
359 
360  default:
361  Q_ASSERT( false ); // In debug mode complain
362  return true; // In release mode accept row
363  }
364  // returns are handled in their respective case statement above
365 }
366 
368 {
370  invalidateFilter();
371 }
372 
373 void QgsAttributeTableFilterModel::selectionChanged()
374 {
375  if ( ShowSelected == mFilterMode )
376  {
377  invalidateFilter();
378  }
379  else if ( mSelectedOnTop )
380  {
381  sort( sortColumn(), sortOrder() );
382  invalidate();
383  }
384 }
385 
386 void QgsAttributeTableFilterModel::onColumnsChanged()
387 {
388  setAttributeTableConfig( mConfig );
389 }
390 
391 int QgsAttributeTableFilterModel::mapColumnToSource( int column ) const
392 {
393  if ( mColumnMapping.isEmpty() )
394  return column;
395  if ( column < 0 || column >= mColumnMapping.size() )
396  return -1;
397  else
398  return mColumnMapping.at( column );
399 }
400 
402 {
403  if ( !layer() )
404  return;
405 
406  bool filter = false;
407  QgsRectangle rect = mCanvas->mapSettings().mapToLayerCoordinates( layer(), mCanvas->extent() );
408  QgsRenderContext renderContext;
410  QgsFeatureRenderer *renderer = layer()->renderer();
411 
412  mFilteredFeatures.clear();
413 
414  if ( !renderer )
415  {
416  QgsDebugMsg( "Cannot get renderer" );
417  return;
418  }
419 
420  const QgsMapSettings &ms = mCanvas->mapSettings();
421  if ( !layer()->isInScaleRange( ms.scale() ) )
422  {
423  QgsDebugMsg( "Out of scale limits" );
424  }
425  else
426  {
427  if ( renderer && renderer->capabilities() & QgsFeatureRenderer::ScaleDependent )
428  {
429  // setup scale
430  // mapRenderer()->renderContext()->scale is not automatically updated when
431  // render extent changes (because it's scale is used to identify if changed
432  // since last render) -> use local context
433  renderContext.setExtent( ms.visibleExtent() );
434  renderContext.setMapToPixel( ms.mapToPixel() );
435  renderContext.setRendererScale( ms.scale() );
436  }
437 
438  filter = renderer && renderer->capabilities() & QgsFeatureRenderer::Filter;
439  }
440 
441  renderer->startRender( renderContext, layer()->fields() );
442 
443  QgsFeatureRequest r( masterModel()->request() );
444  if ( !r.filterRect().isNull() )
445  {
446  r.setFilterRect( r.filterRect().intersect( &rect ) );
447  }
448  else
449  {
450  r.setFilterRect( rect );
451  }
453 
454  QgsFeature f;
455 
456  while ( features.nextFeature( f ) )
457  {
458  renderContext.expressionContext().setFeature( f );
459  if ( !filter || renderer->willRenderFeature( f, renderContext ) )
460  {
461  mFilteredFeatures << f.id();
462  }
463 #if 0
464  if ( t.elapsed() > 5000 )
465  {
466  bool cancel = false;
467  emit progress( i, cancel );
468  if ( cancel )
469  break;
470 
471  t.restart();
472  }
473 #endif
474  }
475 
476  features.close();
477 
478  if ( renderer && renderer->capabilities() & QgsFeatureRenderer::ScaleDependent )
479  {
480  renderer->stopRender( renderContext );
481  }
482 }
483 
485 {
486  return masterModel()->rowToId( mapToSource( row ).row() );
487 }
488 
490 {
491  return mapFromMaster( masterModel()->idToIndex( fid ) );
492 }
493 
495 {
496  QModelIndexList indexes;
497  Q_FOREACH ( const QModelIndex &idx, masterModel()->idToIndexList( fid ) )
498  {
499  indexes.append( mapFromMaster( idx ) );
500  }
501 
502  return indexes;
503 }
504 
505 QModelIndex QgsAttributeTableFilterModel::mapToSource( const QModelIndex &proxyIndex ) const
506 {
507  if ( !proxyIndex.isValid() )
508  return QModelIndex();
509 
510  int sourceColumn = mapColumnToSource( proxyIndex.column() );
511 
512  // For the action column there is no matching column in the source model, just return the first one
513  // so we are still able to query for the feature id, the feature...
514  if ( sourceColumn == -1 )
515  sourceColumn = 0;
516 
517  return QSortFilterProxyModel::mapToSource( index( proxyIndex.row(), sourceColumn, proxyIndex.parent() ) );
518 }
519 
520 QModelIndex QgsAttributeTableFilterModel::mapFromSource( const QModelIndex &sourceIndex ) const
521 {
522  QModelIndex proxyIndex = QSortFilterProxyModel::mapFromSource( sourceIndex );
523 
524  if ( proxyIndex.column() < 0 )
525  return QModelIndex();
526 
527  int col = mapColumnToSource( proxyIndex.column() );
528  if ( col == -1 )
529  col = 0;
530 
531  return index( proxyIndex.row(), col, proxyIndex.parent() );
532 }
533 
534 Qt::ItemFlags QgsAttributeTableFilterModel::flags( const QModelIndex &index ) const
535 {
536  // Handle the action column flags here, the master model doesn't know it
537  if ( mapColumnToSource( index.column() ) == -1 )
538  return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
539 
540  QModelIndex source_index = mapToSource( index );
541  return masterModel()->flags( source_index );
542 }
543 
int lookupField(const QString &fieldName) const
Look up field&#39;s index from the field name.
Definition: qgsfields.cpp:289
virtual bool willRenderFeature(QgsFeature &feat, QgsRenderContext &context)
Returns whether the renderer will render a feature or not.
void generateListOfVisibleFeatures()
Updates the list of currently visible features on the map canvas.
QgsFeatureId id
Definition: qgsfeature.h:70
QgsFeatureId rowToId(const QModelIndex &row)
Returns the feature id for a given model index.
QgsVectorLayer * layer() const
Returns the layer this filter acts on.
Wrapper for iterator of features from vector data provider or vector layer.
virtual QVariant data(const QModelIndex &index, int role) const override
QgsAttributeTableConfig::Type type
The type of this column.
int extraColumns() const
Empty extra columns to announce from this model.
A rectangle specified with double values.
Definition: qgsrectangle.h:38
Depends on scale if feature will be rendered (rule based )
Definition: qgsrenderer.h:195
void update(const QgsFields &fields)
Update the configuration with the given fields.
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
Returns true if the source row will be accepted.
bool selectedOnTop()
Returns if selected features are currently shown on top.
void setAttributeTableConfig(const QgsAttributeTableConfig &config)
Set the attribute table configuration to control which fields are shown, in which order they are show...
QgsAttributeTableModel * masterModel() const
Returns the table model this filter is using.
void setSelectedOnTop(bool selectedOnTop)
Changes the sort order of the features.
void setFilterMode(FilterMode filterMode)
Set the filter mode the filter will use.
QModelIndex mapFromMaster(const QModelIndex &sourceIndex) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
#define QgsDebugMsg(str)
Definition: qgslogger.h:37
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:519
Features may be filtered, i.e. some features may not be rendered (categorized, rule based ...
Definition: qgsrenderer.h:194
void setRendererScale(double scale)
Sets the renderer map scale.
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
Used by the sorting algorithm.
QgsPoint mapToLayerCoordinates(const QgsMapLayer *layer, QgsPoint point) const
transform point coordinates from output CRS to layer&#39;s CRS
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
QgsRectangle intersect(const QgsRectangle *rect) const
Return the intersection with the given rectangle.
This column represents an action widget.
bool isFeatureAdded(QgsFeatureId id) const
Returns true if the specified feature ID has been added but not committed.
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:61
A model backed by a QgsVectorLayerCache which is able to provide feature/attribute information to a Q...
Show only visible features (depends on the map canvas)
const QgsRectangle & filterRect() const
Get the rectangle from which features will be taken.
void setExtent(const QgsRectangle &extent)
QgsRectangle visibleExtent() const
Return the actual extent derived from requested extent that takes takes output image size into accoun...
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:73
bool qgsVariantLessThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is less than the second.
Definition: qgis.cpp:136
virtual void setFilteredFeatures(const QgsFeatureIds &ids)
Specify a list of features, which the filter will accept.
QgsFields fields() const
Returns the list of fields of this layer.
The QgsMapSettings class contains configuration for rendering of the map.
Get the feature id of the feature in this row.
int actionColumnIndex() const
Get the index of the first column that contains an action widget.
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
Needs to be called when a new render cycle is started.
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
FilterMode filterMode()
The current filterModel.
const QgsFeatureIds & selectedFeatureIds() const
Return reference to identifiers of selected features.
QgsAttributeTableFilterModel(QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent=0)
Make sure, the master model is already loaded, so the selection will get synchronized.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns.
FilterMode
The filter mode defines how the rows should be filtered.
double scale() const
Return the calculated scale of the map.
void selectionChanged(const QgsFeatureIds &selected, const QgsFeatureIds &deselected, const bool clearAndSelect)
This signal is emitted when selection was changed.
QgsRectangle extent() const
Returns the current zoom extent of the map canvas.
bool hidden
Flag that controls if the column is hidden.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QgsVectorLayerCache * layerCache() const
Returns the layer cache this model uses as backend.
QgsFeatureRenderer * renderer()
Return renderer.
Show only features which have unsaved changes.
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer&#39;s project and layer.
bool isFeatureAttributesChanged(QgsFeatureId id) const
Returns true if the specified feature ID has had an attribute changed but not committed.
const QgsMapToPixel & mapToPixel() const
QString name
The name of the attribute if this column represents a field.
void setSourceModel(QgsAttributeTableModel *sourceModel)
Set the attribute table model that backs this model.
void extentsChanged()
Is called upon every change of the visible extents on the map canvas.
QString sortExpression() const
The expression which is used to sort the attribute table.
QgsExpressionContext & expressionContext()
Gets the expression context.
Show only features whose ids are on the filter list. {.
QVector< QgsAttributeTableConfig::ColumnConfig > columns() const
Get the list with all columns and their configuration.
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
Contains information about the context of a rendering operation.
virtual void stopRender(QgsRenderContext &context)=0
Needs to be called when a render cycle has finished to clean up.
virtual void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
Sort by the given column using the given order.
int columnCount(const QModelIndex &parent) const override
void setMapToPixel(const QgsMapToPixel &mtp)
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
Defines the configuration of a column in the attribute table.
QgsFeatureId rowToId(int row) const
Maps row to feature id.
qint64 QgsFeatureId
Definition: qgsfeature.h:37
QString sortCacheExpression() const
The expression which was used to fill the sorting cache.
QgsFeatureIds filteredFeatures()
Get a list of currently filtered feature ids.
void appendScopes(const QList< QgsExpressionContextScope *> &scopes)
Appends a list of scopes to the end of the context.
virtual Capabilities capabilities()
Returns details about internals of this renderer.
Definition: qgsrenderer.h:212
bool nextFeature(QgsFeature &f)
This is a container for configuration of the attribute table.
Qt::SortOrder sortOrder() const
Get the sort order.
QString sortExpression() const
Get the expression used for sorting.
void sortColumnChanged(int column, Qt::SortOrder order)
Is emitted whenever the sort column is changed.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &featureRequest=QgsFeatureRequest())
Query this VectorLayerCache for features.
QModelIndexList fidToIndexList(QgsFeatureId fid)
void extentsChanged()
Emitted when the extents of the map change.
void prefetchColumnData(int column)
Caches the entire data for one column.
QgsFeatureRequest & setFilterRect(const QgsRectangle &rect)
Set rectangle from which features will be taken.
void prefetchSortData(const QString &expression)
Prefetches the entire data for one expression.
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns item flags for the index.
QModelIndex fidToIndex(QgsFeatureId fid) override
virtual Qt::ItemFlags flags(const QModelIndex &index) const override
bool isFeatureGeometryChanged(QgsFeatureId id) const
Returns true if the specified feature ID has had its geometry changed but not committed.