QGIS API Documentation  2.17.0-Master (973e4b0)
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 "qgsvectorlayer.h"
22 #include "qgsfeature.h"
23 #include "qgsmapcanvas.h"
24 #include "qgslogger.h"
25 #include "qgsrendererv2.h"
28 // Filter Model //
30 
32  : QSortFilterProxyModel( parent )
33  , mCanvas( canvas )
34  , mFilterMode( ShowAll )
35  , mSelectedOnTop( false )
36 {
37  setSourceModel( sourceModel );
38  setDynamicSortFilter( true );
40  connect( layer(), SIGNAL( selectionChanged() ), SLOT( selectionChanged() ) );
41 }
42 
43 bool QgsAttributeTableFilterModel::lessThan( const QModelIndex &left, const QModelIndex &right ) const
44 {
45  if ( mSelectedOnTop )
46  {
47  bool leftSelected = layer()->selectedFeaturesIds().contains( masterModel()->rowToId( left.row() ) );
48  bool rightSelected = layer()->selectedFeaturesIds().contains( masterModel()->rowToId( right.row() ) );
49 
50  if ( leftSelected && !rightSelected )
51  {
52  return sortOrder() == Qt::AscendingOrder;
53  }
54  else if ( rightSelected && !leftSelected )
55  {
56  return sortOrder() == Qt::DescendingOrder;
57  }
58  }
59 
62 }
63 
64 void QgsAttributeTableFilterModel::sort( int column, Qt::SortOrder order )
65 {
66  int myColumn = mColumnMapping.at( column );
67  masterModel()->prefetchColumnData( myColumn );
68  QSortFilterProxyModel::sort( myColumn, order );
69  emit sortColumnChanged( column, order );
70 }
71 
73 {
74  if ( mapColumnToSource( index.column() ) == -1 ) // actions
75  {
76  if ( role == TypeRole )
78  else if ( role == QgsAttributeTableModel::FeatureIdRole )
79  {
82  }
83  }
84  else if ( role == TypeRole )
85  return ColumnTypeField;
86 
87  return QSortFilterProxyModel::data( index, role );
88 }
89 
90 QVariant QgsAttributeTableFilterModel::headerData( int section, Qt::Orientation orientation, int role ) const
91 {
92  if ( orientation == Qt::Horizontal )
93  {
94  if ( mColumnMapping.at( section ) == -1 && role == Qt::DisplayRole )
95  return tr( "Actions" );
96  else
97  return QSortFilterProxyModel::headerData( section, orientation, role );
98  }
99  else
100  {
101  if ( role == Qt::DisplayRole )
102  return section + 1;
103  else
104  {
105  int sourceSection = mapToSource( index( section, ( !mColumnMapping.isEmpty() && mColumnMapping.at( 0 ) == -1 ) ? 1 : 0 ) ).row();
106  return sourceModel()->headerData( sourceSection, orientation, role );
107  }
108  }
109 }
110 
112 {
113  return mColumnMapping.indexOf( -1 );
114 }
115 
117 {
118  Q_UNUSED( parent );
119  return mColumnMapping.count();
120 }
121 
123 {
124  mConfig = config;
125  mConfig.update( layer()->fields() );
126 
127  QVector<int> newColumnMapping;
128 
129  Q_FOREACH ( const QgsAttributeTableConfig::ColumnConfig& columnConfig, mConfig.columns() )
130  {
131  // Hidden? Forget about this column
132  if ( columnConfig.hidden )
133  continue;
134 
135  // The new value for the mapping (field index or -1 for action column)
136  int newValue = ( columnConfig.type == QgsAttributeTableConfig::Action ) ? -1 : layer()->fieldNameIndex( columnConfig.name );
137  newColumnMapping << newValue;
138  }
139 
140  if ( newColumnMapping != mColumnMapping )
141  {
142  bool requiresReset = false;
143  int firstRemovedColumn = -1;
144  int removedColumnCount = 0;
145 
146  // Check if there have a contiguous set of columns have been removed or if we require a full reset
147  for ( int i = 0; i < qMin( newColumnMapping.size(), mColumnMapping.size() - removedColumnCount ); ++i )
148  {
149  if ( newColumnMapping.at( i ) == mColumnMapping.at( i + removedColumnCount ) )
150  continue;
151 
152  if ( firstRemovedColumn == -1 )
153  {
154  firstRemovedColumn = i;
155 
156  while ( i < mColumnMapping.size() - removedColumnCount && mColumnMapping.at( i + removedColumnCount ) != newColumnMapping.at( i ) )
157  {
158  ++removedColumnCount;
159  }
160  }
161  else
162  {
163  requiresReset = true;
164  break;
165  }
166  }
167 
168  // No difference found so far
169  if ( firstRemovedColumn == -1 )
170  {
171  if ( newColumnMapping.size() > mColumnMapping.size() )
172  {
173  // More columns: appended to the end
174  beginInsertColumns( QModelIndex(), mColumnMapping.size(), newColumnMapping.size() - 1 );
175  mColumnMapping = newColumnMapping;
177  }
178  else
179  {
180  // Less columns: removed from the end
181  beginRemoveColumns( QModelIndex(), newColumnMapping.size(), mColumnMapping.size() - 1 );
182  mColumnMapping = newColumnMapping;
184  }
185  }
186  else
187  {
188  if ( newColumnMapping.size() == mColumnMapping.size() - removedColumnCount )
189  {
190  beginRemoveColumns( QModelIndex(), firstRemovedColumn, firstRemovedColumn + removedColumnCount );
191  mColumnMapping = newColumnMapping;
193  }
194  else
195  {
196  requiresReset = true;
197  }
198  }
199 
200  if ( requiresReset )
201  {
202  beginResetModel();
203  mColumnMapping = newColumnMapping;
204  endResetModel();
205  }
206  }
207 
208  sort( config.sortExpression(), config.sortOrder() );
209 }
210 
211 void QgsAttributeTableFilterModel::sort( QString expression, Qt::SortOrder order )
212 {
214  masterModel()->prefetchSortData( expression );
215  QSortFilterProxyModel::sort( 0, order ) ;
216 }
217 
219 {
220  return masterModel()->sortCacheExpression();
221 }
222 
224 {
225  if ( mSelectedOnTop != selectedOnTop )
226  {
227  mSelectedOnTop = selectedOnTop;
228 
229  if ( sortColumn() == -1 )
230  {
231  sort( 0 );
232  }
233  invalidate();
234  }
235 }
236 
238 {
239  mTableModel = sourceModel;
240 
241  for ( int i = 0; i < mTableModel->columnCount() - mTableModel->extraColumns(); ++i )
242  {
243  mColumnMapping.append( i );
244  }
245 
247 
248  // Disconnect any code to update columns in the parent, we handle this manually
249  disconnect( sourceModel, SIGNAL( columnsAboutToBeInserted( QModelIndex, int, int ) ), this, SLOT( _q_sourceColumnsAboutToBeInserted( QModelIndex, int, int ) ) );
250  disconnect( sourceModel, SIGNAL( columnsInserted( QModelIndex, int, int ) ), this, SLOT( _q_sourceColumnsInserted( QModelIndex, int, int ) ) );
251  disconnect( sourceModel, SIGNAL( columnsAboutToBeRemoved( QModelIndex, int, int ) ), this, SLOT( _q_sourceColumnsAboutToBeRemoved( QModelIndex, int, int ) ) );
252  disconnect( sourceModel, SIGNAL( columnsRemoved( QModelIndex, int, int ) ), this, SLOT( _q_sourceColumnsRemoved( QModelIndex, int, int ) ) );
253 
254  connect( mTableModel, SIGNAL( columnsAboutToBeInserted( QModelIndex, int, int ) ), this, SLOT( onColumnsChanged() ) );
255  connect( mTableModel, SIGNAL( columnsAboutToBeRemoved( QModelIndex, int, int ) ), this, SLOT( onColumnsChanged() ) );
256 }
257 
259 {
260  return mSelectedOnTop;
261 }
262 
264 {
265  mFilteredFeatures = ids;
268 }
269 
271 {
272  QgsFeatureIds ids;
273  for ( int i = 0; i < rowCount(); ++i )
274  {
275  QModelIndex row = index( i, 0 );
276  ids << rowToId( row );
277  }
278  return ids;
279 }
280 
282 {
283  if ( filterMode != mFilterMode )
284  {
285  if ( filterMode == ShowVisible )
286  {
287  connect( mCanvas, SIGNAL( extentsChanged() ), this, SLOT( extentsChanged() ) );
289  }
290  else
291  {
292  disconnect( mCanvas, SIGNAL( extentsChanged() ), this, SLOT( extentsChanged() ) );
293  }
294 
295  if ( filterMode == ShowSelected )
296  {
298  }
299 
300  mFilterMode = filterMode;
302  }
303 }
304 
305 bool QgsAttributeTableFilterModel::filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const
306 {
307  Q_UNUSED( sourceParent );
308  switch ( mFilterMode )
309  {
310  case ShowAll:
311  return true;
312 
313  case ShowFilteredList:
314  return mFilteredFeatures.contains( masterModel()->rowToId( sourceRow ) );
315 
316  case ShowSelected:
317  return layer()->selectedFeaturesIds().isEmpty() || layer()->selectedFeaturesIds().contains( masterModel()->rowToId( sourceRow ) );
318 
319  case ShowVisible:
320  return mFilteredFeatures.contains( masterModel()->rowToId( sourceRow ) );
321 
322  case ShowEdited:
323  {
324  QgsVectorLayerEditBuffer* editBuffer = layer()->editBuffer();
325  if ( editBuffer )
326  {
327  const QList<QgsFeatureId> addedFeatures = editBuffer->addedFeatures().keys();
328  const QList<QgsFeatureId> changedFeatures = editBuffer->changedAttributeValues().keys();
329  const QList<QgsFeatureId> changedGeometries = editBuffer->changedGeometries().keys();
330  const QgsFeatureId fid = masterModel()->rowToId( sourceRow );
331  return addedFeatures.contains( fid ) || changedFeatures.contains( fid ) || changedGeometries.contains( fid );
332  }
333  return false;
334  }
335 
336  default:
337  Q_ASSERT( false ); // In debug mode complain
338  return true; // In release mode accept row
339  }
340  // returns are handled in their respective case statement above
341 }
342 
344 {
347 }
348 
349 void QgsAttributeTableFilterModel::selectionChanged()
350 {
351  if ( ShowSelected == mFilterMode )
352  {
355  }
356  else if ( mSelectedOnTop )
357  {
358  sort( sortColumn(), sortOrder() );
359  invalidate();
360  }
361 }
362 
363 void QgsAttributeTableFilterModel::onColumnsChanged()
364 {
365  setAttributeTableConfig( mConfig );
366 }
367 
368 int QgsAttributeTableFilterModel::mapColumnToSource( int column ) const
369 {
370  if ( mColumnMapping.isEmpty() )
371  return column;
372  if ( column < 0 || column >= mColumnMapping.size() )
373  return -1;
374  else
375  return mColumnMapping.at( column );
376 }
377 
379 {
380  if ( !layer() )
381  return;
382 
383  bool filter = false;
384  QgsRectangle rect = mCanvas->mapSettings().mapToLayerCoordinates( layer(), mCanvas->extent() );
385  QgsRenderContext renderContext;
389  QgsFeatureRendererV2* renderer = layer()->rendererV2();
390 
391  mFilteredFeatures.clear();
392 
393  if ( !renderer )
394  {
395  QgsDebugMsg( "Cannot get renderer" );
396  return;
397  }
398 
399  const QgsMapSettings& ms = mCanvas->mapSettings();
400  if ( !layer()->isInScaleRange( ms.scale() ) )
401  {
402  QgsDebugMsg( "Out of scale limits" );
403  }
404  else
405  {
406  if ( renderer && renderer->capabilities() & QgsFeatureRendererV2::ScaleDependent )
407  {
408  // setup scale
409  // mapRenderer()->renderContext()->scale is not automaticaly updated when
410  // render extent changes (because it's scale is used to identify if changed
411  // since last render) -> use local context
412  renderContext.setExtent( ms.visibleExtent() );
413  renderContext.setMapToPixel( ms.mapToPixel() );
414  renderContext.setRendererScale( ms.scale() );
415  }
416 
417  filter = renderer && renderer->capabilities() & QgsFeatureRendererV2::Filter;
418  }
419 
420  renderer->startRender( renderContext, layer()->fields() );
421 
422  QgsFeatureRequest r( masterModel()->request() );
423  if ( !r.filterRect().isNull() )
424  {
425  r.setFilterRect( r.filterRect().intersect( &rect ) );
426  }
427  else
428  {
429  r.setFilterRect( rect );
430  }
432 
433  QgsFeature f;
434 
435  while ( features.nextFeature( f ) )
436  {
437  renderContext.expressionContext().setFeature( f );
438  if ( !filter || renderer->willRenderFeature( f, renderContext ) )
439  {
440  mFilteredFeatures << f.id();
441  }
442 #if 0
443  if ( t.elapsed() > 5000 )
444  {
445  bool cancel = false;
446  emit progress( i, cancel );
447  if ( cancel )
448  break;
449 
450  t.restart();
451  }
452 #endif
453  }
454 
455  features.close();
456 
457  if ( renderer && renderer->capabilities() & QgsFeatureRendererV2::ScaleDependent )
458  {
459  renderer->stopRender( renderContext );
460  }
461 }
462 
464 {
465  return masterModel()->rowToId( mapToSource( row ).row() );
466 }
467 
469 {
470  return mapFromMaster( masterModel()->idToIndex( fid ) );
471 }
472 
474 {
475  QModelIndexList indexes;
476  Q_FOREACH ( const QModelIndex& idx, masterModel()->idToIndexList( fid ) )
477  {
478  indexes.append( mapFromMaster( idx ) );
479  }
480 
481  return indexes;
482 }
483 
485 {
486  if ( !proxyIndex.isValid() )
487  return QModelIndex();
488 
489  int sourceColumn = mapColumnToSource( proxyIndex.column() );
490 
491  // For the action column there is no matching column in the source model, just return the first one
492  // so we are still able to query for the feature id, the feature...
493  if ( sourceColumn == -1 )
494  sourceColumn = 0;
495 
496  return QSortFilterProxyModel::mapToSource( index( proxyIndex.row(), sourceColumn, proxyIndex.parent() ) );
497 }
498 
500 {
501  QModelIndex proxyIndex = QSortFilterProxyModel::mapFromSource( sourceIndex );
502 
503  if ( proxyIndex.column() < 0 )
504  return QModelIndex();
505 
506  int col = mapColumnToSource( proxyIndex.column() );
507  if ( col == -1 )
508  col = 0;
509 
510  return index( proxyIndex.row(), col , proxyIndex.parent() );
511 }
512 
514 {
515  // Handle the action column flags here, the master model doesn't know it
516  if ( mapColumnToSource( index.column() ) == -1 )
517  return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
518 
519  QModelIndex source_index = mapToSource( index );
520  return masterModel()->flags( source_index );
521 }
522 
QgsFeatureId id() const
Get the feature ID for this feature.
Definition: qgsfeature.cpp:65
void generateListOfVisibleFeatures()
Updates the list of currently visible features on the map canvas.
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
const QgsGeometryMap & changedGeometries()
Changed geometries which are not commited.
QgsFeatureId rowToId(const QModelIndex &row)
Returns the feature id for a given model index.
Wrapper for iterator of features from vector data provider or vector layer.
virtual QVariant data(const QModelIndex &index, int role) const override
void setSortRole(int role)
A rectangle specified with double values.
Definition: qgsrectangle.h:35
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...
double scale() const
Return the calculated scale of the map.
void setSelectedOnTop(bool selectedOnTop)
Changes the sort order of the features.
virtual void sort(int column, Qt::SortOrder order)
int actionColumnIndex() const
Get the index of the first column that contains an action widget.
void setFilterMode(FilterMode filterMode)
Set the filter mode the filter will use.
void append(const T &value)
const QgsRectangle & filterRect() const
Get the rectangle from which features will be taken.
virtual void setSourceModel(QAbstractItemModel *sourceModel)
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
#define QgsDebugMsg(str)
Definition: qgslogger.h:33
int extraColumns() const
Empty extra columns to announce from this model.
int indexOf(const T &value, int from) const
void setRendererScale(double scale)
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
Used by the sorting algorithm.
const QgsChangedAttributesMap & changedAttributeValues()
Changed attributes values which are not commited.
bool isNull() const
test if the rectangle is null (all coordinates zero or after call to setMinimal()).
QgsRectangle visibleExtent() const
Return the actual extent derived from requested extent that takes takes output image size into accoun...
void columnsRemoved(const QModelIndex &parent, int start, int end)
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
This column represents an action widget.
const QgsMapToPixel & mapToPixel() const
depends on scale if feature will be rendered (rule based )
QString sortCacheExpression() const
The expression which was used to fill the sorting cache.
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:187
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)
QgsPoint mapToLayerCoordinates(QgsMapLayer *theLayer, QgsPoint point) const
transform point coordinates from output CRS to layer&#39;s CRS
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
virtual Q_DECL_DEPRECATED bool willRenderFeature(QgsFeature &feat)
Returns whether the renderer will render a feature or not.
QString tr(const char *sourceText, const char *disambiguation, int n)
void setExtent(const QgsRectangle &extent)
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:109
virtual int rowCount(const QModelIndex &parent) const
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:269
QgsAttributeTableFilterModel(QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent=nullptr)
Make sure, the master model is already loaded, so the selection will get synchronized.
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
Needs to be called when a new render cycle is started.
virtual void setFilteredFeatures(const QgsFeatureIds &ids)
Specify a list of features, which the filter will accept.
The QgsMapSettings class contains configuration for rendering of the map.
QString sortExpression() const
Get the expression used for sorting.
virtual void stopRender(QgsRenderContext &context)=0
Needs to be called when a render cycle has finished to clean up.
Get the feature id of the feature in this row.
QgsVectorLayer * layer() const
Returns the layer this filter acts on.
QList< Key > keys() const
bool isValid() const
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
Qt::SortOrder sortOrder() const
Get the sort order.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
FilterMode filterMode()
The current filterModel.
const QgsFeatureIds & selectedFeaturesIds() const
Return reference to identifiers of selected features.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns.
FilterMode
The filter mode defines how the rows should be filtered.
int row() const
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)...
void beginRemoveColumns(const QModelIndex &parent, int first, int last)
void setDynamicSortFilter(bool enable)
virtual QVariant data(const QModelIndex &index, int role) const =0
Show only features which have unsaved changes.
QModelIndex parent() const
void columnsInserted(const QModelIndex &parent, int start, int end)
QgsVectorLayerCache * layerCache() const
Returns the layer cache this model uses as backend.
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) 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.
void columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
bool contains(const T &value) const
QgsExpressionContext & expressionContext()
Gets the expression context.
Show only features whose ids are on the filter list. {.
bool contains(const T &value) const
QVector< ColumnConfig > columns() const
Get the list with all columns and their configuration.
const QgsFeatureMap & addedFeatures()
New features which are not commited.
const T & at(int i) const
Contains information about the context of a rendering operation.
QAbstractItemModel * sourceModel() const
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const
QgsAttributeTableModel * masterModel() const
Returns the table model this filter is using.
QModelIndex mapFromMaster(const QModelIndex &sourceIndex) const
Qt::SortOrder sortOrder() const
QVariant data(int role) const
virtual void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
Sort by the given column using the given order.
QString sortExpression() const
The expression which is used to sort the attribute table.
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const
bool isEmpty() const
QgsRectangle intersect(const QgsRectangle *rect) const
return the intersection with the given rectangle
int columnCount(const QModelIndex &parent) const override
int count(const T &value) const
void setMapToPixel(const QgsMapToPixel &mtp)
int column() const
bool isEmpty() const
Defines the configuration of a column in the attribute table.
qint64 QgsFeatureId
Definition: qgsfeature.h:31
QgsFeatureIds filteredFeatures()
Get a list of currently filtered feature ids.
QgsRectangle extent() const
Returns the current zoom exent of the map canvas.
QgsFeatureId rowToId(int row) const
Maps row to feature id.
static QgsExpressionContextScope * projectScope()
Creates a new scope which contains variables and functions relating to the current QGIS project...
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
virtual int capabilities()
returns bitwise OR-ed capabilities of the renderer
bool nextFeature(QgsFeature &f)
features may be filtered, i.e. some features may not be rendered (categorized, rule based ...
void clear()
This is a container for configuration of the attribute table.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * parent() const
int size() const
int fieldNameIndex(const QString &fieldName) const
Returns the index of a field name or -1 if the field does not exist.
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)
int sortColumn() const
void beginInsertColumns(const QModelIndex &parent, int first, int last)
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.
virtual QVariant data(const QModelIndex &index, int role) const
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns item flags for the index.
QModelIndex fidToIndex(QgsFeatureId fid) override
void columnsAboutToBeInserted(const QModelIndex &parent, int start, int end)
virtual Qt::ItemFlags flags(const QModelIndex &index) const override
typedef ItemFlags