QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsfeaturelistview.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  QgsAttributeTableView.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 <QHeaderView>
17 #include <QKeyEvent>
18 #include <QMenu>
19 #include <QSet>
20 #include <QSettings>
21 
24 #include "qgsattributetablemodel.h"
25 #include "qgsfeaturelistmodel.h"
27 #include "qgsfeaturelistview.h"
29 #include "qgslogger.h"
30 #include "qgsmapcanvas.h"
31 #include "qgsvectordataprovider.h"
32 #include "qgsvectorlayer.h"
34 
36  : QListView( parent )
37 {
38  setSelectionMode( QAbstractItemView::ExtendedSelection );
39 }
40 
42 {
43  return mModel->layerCache();
44 }
45 
47 {
48  QListView::setModel( featureListModel );
49  mModel = featureListModel;
50 
51  delete mFeatureSelectionModel;
52  delete mCurrentEditSelectionModel;
53 
54  mCurrentEditSelectionModel = new QItemSelectionModel( mModel->masterModel(), this );
55  if ( !mFeatureSelectionManager )
56  {
57  mOwnedFeatureSelectionManager = new QgsVectorLayerSelectionManager( mModel->layerCache()->layer(), mModel );
58  mFeatureSelectionManager = mOwnedFeatureSelectionManager;
59  }
60 
61  mFeatureSelectionModel = new QgsFeatureSelectionModel( featureListModel, featureListModel, mFeatureSelectionManager, this );
62  setSelectionModel( mFeatureSelectionModel );
63  connect( featureListModel->layerCache()->layer(), &QgsVectorLayer::selectionChanged, this, [ this ]()
64  {
65  ensureEditSelection( true );
66  } );
67 
68  if ( mItemDelegate && mItemDelegate->parent() == this )
69  {
70  delete mItemDelegate;
71  }
72 
73  mItemDelegate = new QgsFeatureListViewDelegate( mModel, this );
74  mItemDelegate->setEditSelectionModel( mCurrentEditSelectionModel );
75  setItemDelegate( mItemDelegate );
76 
77  mItemDelegate->setFeatureSelectionModel( mFeatureSelectionModel );
78  connect( mFeatureSelectionModel, static_cast<void ( QgsFeatureSelectionModel::* )( const QModelIndexList &indexes )>( &QgsFeatureSelectionModel::requestRepaint ),
79  this, static_cast<void ( QgsFeatureListView::* )( const QModelIndexList &indexes )>( &QgsFeatureListView::repaintRequested ) );
80  connect( mFeatureSelectionModel, static_cast<void ( QgsFeatureSelectionModel::* )()>( &QgsFeatureSelectionModel::requestRepaint ),
81  this, static_cast<void ( QgsFeatureListView::* )()>( &QgsFeatureListView::repaintRequested ) );
82  connect( mCurrentEditSelectionModel, &QItemSelectionModel::selectionChanged, this, &QgsFeatureListView::editSelectionChanged );
83  connect( mModel->layerCache()->layer(), &QgsVectorLayer::attributeValueChanged, this, [ = ] { repaintRequested(); } );
84  connect( featureListModel, &QgsFeatureListModel::rowsRemoved, this, [ this ]() { ensureEditSelection(); } );
85  connect( featureListModel, &QgsFeatureListModel::rowsInserted, this, [ this ]() { ensureEditSelection(); } );
86  connect( featureListModel, &QgsFeatureListModel::modelReset, this, [ this ]() { ensureEditSelection(); } );
87 }
88 
89 bool QgsFeatureListView::setDisplayExpression( const QString &expression )
90 {
91  if ( mModel->setDisplayExpression( expression ) )
92  {
93  emit displayExpressionChanged( expression );
94  return true;
95  }
96  else
97  {
98  return false;
99  }
100 }
101 
103 {
104  return mModel->displayExpression();
105 }
106 
108 {
109  return mModel->parserErrorString();
110 }
111 
113 {
114  QgsFeatureIds selection;
115  const QModelIndexList selectedIndexes = mCurrentEditSelectionModel->selectedIndexes();
116  for ( const QModelIndex &idx : selectedIndexes )
117  {
118  selection << idx.data( QgsAttributeTableModel::FeatureIdRole ).value<QgsFeatureId>();
119  }
120  return selection;
121 }
122 
124 {
125  mItemDelegate->setCurrentFeatureEdited( state );
126  viewport()->update( visualRegionForSelection( mCurrentEditSelectionModel->selection() ) );
127 }
128 
129 void QgsFeatureListView::mousePressEvent( QMouseEvent *event )
130 {
131  if ( mModel )
132  {
133  QPoint pos = event->pos();
134 
135  QModelIndex index = indexAt( pos );
136 
137  if ( QgsFeatureListViewDelegate::EditElement == mItemDelegate->positionToElement( event->pos() ) )
138  {
139 
140  mEditSelectionDrag = true;
141  if ( index.isValid() )
142  setEditSelection( mModel->mapToMaster( index ), QItemSelectionModel::ClearAndSelect );
143  }
144  else
145  {
146  mFeatureSelectionModel->enableSync( false );
147  selectRow( index, true );
149  }
150  }
151  else
152  {
153  QgsDebugMsg( QStringLiteral( "No model assigned to this view" ) );
154  }
155 }
156 
157 void QgsFeatureListView::editSelectionChanged( const QItemSelection &deselected, const QItemSelection &selected )
158 {
159  if ( isVisible() && updatesEnabled() )
160  {
161  QItemSelection localDeselected = mModel->mapSelectionFromMaster( deselected );
162  QItemSelection localSelected = mModel->mapSelectionFromMaster( selected );
163  viewport()->update( visualRegionForSelection( localDeselected ) | visualRegionForSelection( localSelected ) );
164  }
165  updateEditSelectionDependencies();
166 }
167 
168 void QgsFeatureListView::updateEditSelectionDependencies()
169 {
170  QItemSelection currentSelection = mCurrentEditSelectionModel->selection();
171  if ( currentSelection.size() == 1 )
172  {
173  QModelIndexList indexList = currentSelection.indexes();
174  if ( !indexList.isEmpty() )
175  {
176  QgsFeature feat;
177  mModel->featureByIndex( mModel->mapFromMaster( indexList.first() ), feat );
178 
179  emit currentEditSelectionChanged( feat );
180  emit currentEditSelectionProgressChanged( mModel->mapFromMaster( indexList.first() ).row(), mModel->rowCount() );
181  }
182  }
183 }
184 
186 {
187  QItemSelection selection;
188  selection.append( QItemSelectionRange( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, 0 ) ) );
189 
190  mFeatureSelectionModel->selectFeatures( selection, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows );
191 }
192 
194 {
195  QItemSelection selection;
196 
197  const auto constFids = fids;
198  for ( QgsFeatureId fid : constFids )
199  {
200  selection.append( QItemSelectionRange( mModel->mapToMaster( mModel->fidToIdx( fid ) ) ) );
201  }
202 
203  bool ok = true;
204  emit aboutToChangeEditSelection( ok );
205 
206  if ( ok )
207  mCurrentEditSelectionModel->select( selection, QItemSelectionModel::ClearAndSelect );
208 }
209 
210 void QgsFeatureListView::setEditSelection( const QModelIndex &index, QItemSelectionModel::SelectionFlags command )
211 {
212  bool ok = true;
213  emit aboutToChangeEditSelection( ok );
214 
215  // cppcheck-suppress assertWithSideEffect
216  Q_ASSERT( index.model() == mModel->masterModel() || !index.isValid() );
217 
218  if ( ok )
219  mCurrentEditSelectionModel->select( index, command );
220 }
221 
222 void QgsFeatureListView::repaintRequested( const QModelIndexList &indexes )
223 {
224  const auto constIndexes = indexes;
225  for ( const QModelIndex &index : constIndexes )
226  {
227  update( index );
228  }
229 }
230 
232 {
233  setDirtyRegion( viewport()->rect() );
234 }
235 
236 void QgsFeatureListView::mouseMoveEvent( QMouseEvent *event )
237 {
238  QPoint pos = event->pos();
239 
240  QModelIndex index = indexAt( pos );
241 
242  if ( mEditSelectionDrag )
243  {
244  if ( index.isValid() )
245  setEditSelection( mModel->mapToMaster( index ), QItemSelectionModel::ClearAndSelect );
246  }
247  else
248  {
249  selectRow( index, false );
250  }
251 }
252 
253 void QgsFeatureListView::mouseReleaseEvent( QMouseEvent *event )
254 {
255  Q_UNUSED( event )
256 
257  if ( mEditSelectionDrag )
258  {
259  mEditSelectionDrag = false;
260  }
261  else
262  {
263  if ( mFeatureSelectionModel )
264  mFeatureSelectionModel->enableSync( true );
265  }
266 }
267 
268 void QgsFeatureListView::keyPressEvent( QKeyEvent *event )
269 {
270  switch ( event->key() )
271  {
272  case Qt::Key_Up:
273  editOtherFeature( Previous );
274  break;
275 
276  case Qt::Key_Down:
277  editOtherFeature( Next );
278  break;
279 
280  default:
281  QListView::keyPressEvent( event );
282  }
283 }
284 
285 void QgsFeatureListView::editOtherFeature( QgsFeatureListView::PositionInList positionInList )
286 {
287  int currentRow = 0;
288  if ( 0 != mCurrentEditSelectionModel->selectedIndexes().count() )
289  {
290  QModelIndex localIndex = mModel->mapFromMaster( mCurrentEditSelectionModel->selectedIndexes().first() );
291  currentRow = localIndex.row();
292  }
293 
294  QModelIndex newLocalIndex;
295  QModelIndex newIndex;
296 
297  switch ( positionInList )
298  {
299  case First:
300  newLocalIndex = mModel->index( 0, 0 );
301  break;
302 
303  case Previous:
304  newLocalIndex = mModel->index( currentRow - 1, 0 );
305  break;
306 
307  case Next:
308  newLocalIndex = mModel->index( currentRow + 1, 0 );
309  break;
310 
311  case Last:
312  newLocalIndex = mModel->index( mModel->rowCount() - 1, 0 );
313  break;
314  }
315 
316  newIndex = mModel->mapToMaster( newLocalIndex );
317  if ( newIndex.isValid() )
318  {
319  setEditSelection( newIndex, QItemSelectionModel::ClearAndSelect );
320  scrollTo( newLocalIndex );
321  }
322 }
323 
324 void QgsFeatureListView::contextMenuEvent( QContextMenuEvent *event )
325 {
326  QModelIndex index = indexAt( event->pos() );
327 
328  if ( index.isValid() )
329  {
330  QgsFeature feature = mModel->data( index, QgsFeatureListModel::FeatureRole ).value<QgsFeature>();
331 
332  QgsActionMenu *menu = new QgsActionMenu( mModel->layerCache()->layer(), feature, QStringLiteral( "Feature" ), this );
333 
334  // Index is from feature list model, but we need an index from the
335  // filter model to be passed to listeners, using fid instead would
336  // have been much better in term of bugs (and headaches) but this
337  // belongs to the API unfortunately.
338  emit willShowContextMenu( menu, mModel->mapToSource( index ) );
339 
340  menu->exec( event->globalPos() );
341  }
342 }
343 
344 void QgsFeatureListView::selectRow( const QModelIndex &index, bool anchor )
345 {
346  QItemSelectionModel::SelectionFlags command = selectionCommand( index );
347  int row = index.row();
348 
349  if ( anchor )
350  mRowAnchor = row;
351 
352  if ( selectionMode() != QListView::SingleSelection
353  && command.testFlag( QItemSelectionModel::Toggle ) )
354  {
355  if ( anchor )
356  mCtrlDragSelectionFlag = mFeatureSelectionModel->isSelected( index )
357  ? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
358  command &= ~QItemSelectionModel::Toggle;
359  command |= mCtrlDragSelectionFlag;
360  if ( !anchor )
361  command |= QItemSelectionModel::Current;
362  }
363 
364  QModelIndex tl = model()->index( std::min( mRowAnchor, row ), 0 );
365  QModelIndex br = model()->index( std::max( mRowAnchor, row ), model()->columnCount() - 1 );
366 
367  mFeatureSelectionModel->selectFeatures( QItemSelection( tl, br ), command );
368 }
369 
370 void QgsFeatureListView::ensureEditSelection( bool inSelection )
371 {
372  if ( !mModel->rowCount() )
373  {
374  // not sure this is the best place to emit from
375  // this will allow setting the counter to zero in the browsing panel
377  return;
378  }
379 
380  const QModelIndexList selectedIndexes = mCurrentEditSelectionModel->selectedIndexes();
381 
382  // We potentially want a new edit selection
383  // If we it should be in the feature selection
384  // but we don't find a matching one we might
385  // still stick to the old edit selection
386  bool editSelectionUpdateRequested = false;
387  // There is a valid selection available which we
388  // could fall back to
389  bool validEditSelectionAvailable = false;
390 
391  if ( selectedIndexes.isEmpty() || !selectedIndexes.first().isValid() || mModel->mapFromMaster( selectedIndexes.first() ).row() == -1 )
392  {
393  validEditSelectionAvailable = false;
394  }
395  else
396  {
397  validEditSelectionAvailable = true;
398  }
399 
400  // If we want to force the edit selection to be within the feature selection
401  // let's do some additional checks
402  if ( inSelection )
403  {
404  // no valid edit selection, update anyway
405  if ( !validEditSelectionAvailable )
406  {
407  editSelectionUpdateRequested = true;
408  }
409  else
410  {
411  // valid selection: update only if it's not in the feature selection
412  const QgsFeatureIds selectedFids = layerCache()->layer()->selectedFeatureIds();
413 
414  if ( !selectedFids.contains( mModel->idxToFid( mModel->mapFromMaster( selectedIndexes.first() ) ) ) )
415  {
416  editSelectionUpdateRequested = true;
417  }
418  }
419  }
420  else
421  {
422  // we don't care if the edit selection is in the feature selection?
423  // well then, only update if there is no valid edit selection available
424  if ( !validEditSelectionAvailable )
425  editSelectionUpdateRequested = true;
426  }
427 
428  if ( editSelectionUpdateRequested )
429  {
430  if ( !mUpdateEditSelectionTimer.isSingleShot() )
431  {
432  mUpdateEditSelectionTimer.setSingleShot( true );
433  connect( &mUpdateEditSelectionTimer, &QTimer::timeout, this, [ this, inSelection, validEditSelectionAvailable ]()
434  {
435  // The layer might have been removed between timer start and timer triggered
436  // in this case there is nothing left for us to do.
437  if ( !layerCache() )
438  return;
439 
440  int rowToSelect = -1;
441 
442  if ( inSelection )
443  {
444  const QgsFeatureIds selectedFids = layerCache()->layer()->selectedFeatureIds();
445  const int rowCount = mModel->rowCount();
446 
447  for ( int i = 0; i < rowCount; i++ )
448  {
449  if ( selectedFids.contains( mModel->idxToFid( mModel->index( i, 0 ) ) ) )
450  {
451  rowToSelect = i;
452  break;
453  }
454 
455  if ( rowToSelect == -1 && !validEditSelectionAvailable )
456  rowToSelect = 0;
457  }
458  }
459  else
460  rowToSelect = 0;
461 
462  if ( rowToSelect != -1 )
463  {
464  setEditSelection( mModel->mapToMaster( mModel->index( rowToSelect, 0 ) ), QItemSelectionModel::ClearAndSelect );
465  }
466  } );
467  mUpdateEditSelectionTimer.setInterval( 0 );
468  }
469  mUpdateEditSelectionTimer.start();
470  }
471  updateEditSelectionDependencies();
472 }
473 
475 {
476  mFeatureSelectionManager = featureSelectionManager;
477 
478  if ( mFeatureSelectionModel )
479  mFeatureSelectionModel->setFeatureSelectionManager( mFeatureSelectionManager );
480 
481  // only delete the owned selection manager and not one created from outside
482  if ( mOwnedFeatureSelectionManager )
483  {
484  mOwnedFeatureSelectionManager->deleteLater();
485  mOwnedFeatureSelectionManager = nullptr;
486  }
487 }
QgsFeatureListModel::setDisplayExpression
bool setDisplayExpression(const QString &expression)
Definition: qgsfeaturelistmodel.cpp:209
QgsFeatureListView::displayExpressionChanged
void displayExpressionChanged(const QString &expression)
Emitted whenever the display expression is successfully changed.
QgsFeatureListView::parserErrorString
QString parserErrorString()
Returns a detailed message about errors while parsing a QgsExpression.
Definition: qgsfeaturelistview.cpp:107
QgsFeatureListViewDelegate::setFeatureSelectionModel
void setFeatureSelectionModel(QgsFeatureSelectionModel *featureSelectionModel)
Definition: qgsfeaturelistviewdelegate.cpp:49
QgsVectorLayerCache
The cached features can be indexed by QgsAbstractCacheIndex.
Definition: qgsvectorlayercache.h:45
QgsFeatureListModel::featureByIndex
bool featureByIndex(const QModelIndex &index, QgsFeature &feat)
Definition: qgsfeaturelistmodel.cpp:242
QgsFeatureSelectionModel
Definition: qgsfeatureselectionmodel.h:31
qgsmapcanvas.h
QgsFeatureListModel::mapToSource
QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
Definition: qgsfeaturelistmodel.cpp:350
QgsFeatureListView::displayExpression
const QString displayExpression() const
Returns the expression which is currently used to render the features.
Definition: qgsfeaturelistview.cpp:102
QgsFeatureListView::currentEditSelection
QgsFeatureIds currentEditSelection()
Gets the currentEditSelection.
Definition: qgsfeaturelistview.cpp:112
QgsFeatureListView::selectAll
void selectAll() override
Select all currently visible features.
Definition: qgsfeaturelistview.cpp:185
QgsFeatureSelectionModel::isSelected
virtual bool isSelected(QgsFeatureId fid)
Returns the selection status of a given feature id.
Definition: qgsfeatureselectionmodel.cpp:53
QgsFeatureListModel::mapToMaster
virtual QModelIndex mapToMaster(const QModelIndex &proxyIndex) const
Definition: qgsfeaturelistmodel.cpp:297
QgsFeatureListView::setEditSelection
void setEditSelection(const QgsFeatureIds &fids)
Set the feature(s) to be edited.
Definition: qgsfeaturelistview.cpp:193
qgsfeaturelistmodel.h
QgsFeatureListView
Definition: qgsfeaturelistview.h:45
QgsDebugMsg
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
QgsFeatureListView::setFeatureSelectionManager
void setFeatureSelectionManager(QgsIFeatureSelectionManager *featureSelectionManager)
setFeatureSelectionManager
Definition: qgsfeaturelistview.cpp:474
QgsFeatureListView::keyPressEvent
void keyPressEvent(QKeyEvent *event) override
Definition: qgsfeaturelistview.cpp:268
QgsFeatureListModel::data
QVariant data(const QModelIndex &index, int role) const override
Definition: qgsfeaturelistmodel.cpp:60
QgsFeatureListModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition: qgsfeaturelistmodel.cpp:400
QgsFeatureListViewDelegate::setCurrentFeatureEdited
void setCurrentFeatureEdited(bool state)
Definition: qgsfeaturelistviewdelegate.cpp:54
QgsFeatureListView::setDisplayExpression
bool setDisplayExpression(const QString &displayExpression)
The display expression is an expression used to render the fields into a single string which is displ...
Definition: qgsfeaturelistview.cpp:89
QgsFeatureListView::contextMenuEvent
void contextMenuEvent(QContextMenuEvent *event) override
Definition: qgsfeaturelistview.cpp:324
QgsFeatureSelectionModel::selectFeatures
virtual void selectFeatures(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command)
Select features on this table.
Definition: qgsfeatureselectionmodel.cpp:72
QgsFeatureListView::QgsFeatureListView
QgsFeatureListView(QWidget *parent=nullptr)
Creates a feature list view.
Definition: qgsfeaturelistview.cpp:35
QgsFeatureListModel::FeatureRole
@ FeatureRole
Definition: qgsfeaturelistmodel.h:62
QgsFeatureListModel::mapFromMaster
virtual QModelIndex mapFromMaster(const QModelIndex &sourceIndex) const
Definition: qgsfeaturelistmodel.cpp:317
QgsFeatureListModel::idxToFid
QgsFeatureId idxToFid(const QModelIndex &index) const
Returns the feature ID corresponding to an index from the model.
Definition: qgsfeaturelistmodel.cpp:50
qgsvectorlayerselectionmanager.h
QgsFeatureListModel::parserErrorString
QString parserErrorString()
Returns a detailed message about errors while parsing a QgsExpression.
Definition: qgsfeaturelistmodel.cpp:232
QgsFeatureListModel::displayExpression
QString displayExpression() const
Definition: qgsfeaturelistmodel.cpp:237
QgsVectorLayer::selectionChanged
void selectionChanged(const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect)
Emitted when selection was changed.
QgsVectorLayer::attributeValueChanged
void attributeValueChanged(QgsFeatureId fid, int idx, const QVariant &value)
Emitted whenever an attribute value change is done in the edit buffer.
qgsattributetablefiltermodel.h
QgsVectorLayer::selectedFeatureIds
const Q_INVOKABLE QgsFeatureIds & selectedFeatureIds() const
Returns a list of the selected features IDs in this layer.
Definition: qgsvectorlayer.cpp:3433
QgsFeatureListView::setModel
virtual void setModel(QgsFeatureListModel *featureListModel)
Set the QgsFeatureListModel which is used to retrieve information.
Definition: qgsfeaturelistview.cpp:46
QgsFeatureSelectionModel::enableSync
void enableSync(bool enable)
Enables or disables synchronisation to the QgsVectorLayer When synchronisation is disabled,...
Definition: qgsfeatureselectionmodel.cpp:31
qgsvectordataprovider.h
QgsActionMenu
Definition: qgsactionmenu.h:37
QgsFeatureListModel::fidToIdx
QModelIndex fidToIdx(QgsFeatureId fid) const
Returns the model index corresponding to a feature ID.
Definition: qgsfeaturelistmodel.cpp:55
qgsfeaturelistviewdelegate.h
qgsattributetablemodel.h
QgsVectorLayerCache::layer
QgsVectorLayer * layer()
Returns the layer to which this cache belongs.
Definition: qgsvectorlayercache.cpp:179
QgsVectorLayerSelectionManager
Definition: qgsvectorlayerselectionmanager.h:32
QgsFeatureListView::setCurrentFeatureEdited
void setCurrentFeatureEdited(bool state)
Sets if the currently shown form has received any edit events so far.
Definition: qgsfeaturelistview.cpp:123
QgsFeatureListView::featureListModel
QgsFeatureListModel * featureListModel()
Gets the featureListModel used by this view.
Definition: qgsfeaturelistview.h:76
QgsFeatureIds
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:34
QgsFeatureListView::repaintRequested
void repaintRequested()
Definition: qgsfeaturelistview.cpp:231
QgsFeatureListViewDelegate::positionToElement
Element positionToElement(QPoint pos)
Definition: qgsfeaturelistviewdelegate.cpp:37
qgsvectorlayer.h
QgsFeatureListModel::masterModel
QgsAttributeTableModel * masterModel()
Definition: qgsfeaturelistmodel.cpp:204
QgsAttributeTableModel::FeatureIdRole
@ FeatureIdRole
Get the feature id of the feature in this row.
Definition: qgsattributetablemodel.h:56
QgsFeatureSelectionModel::setFeatureSelectionManager
virtual void setFeatureSelectionManager(QgsIFeatureSelectionManager *featureSelectionManager)
Definition: qgsfeatureselectionmodel.cpp:156
qgsfeatureselectionmodel.h
QgsFeatureListViewDelegate::setEditSelectionModel
void setEditSelectionModel(QItemSelectionModel *editSelectionModel)
Definition: qgsfeaturelistviewdelegate.cpp:59
QgsFeatureListModel::layerCache
QgsVectorLayerCache * layerCache()
Returns the vector layer cache which is being used to populate the model.
Definition: qgsfeaturelistmodel.cpp:45
qgsfeaturelistview.h
QgsFeatureListModel
Definition: qgsfeaturelistmodel.h:38
QgsFeatureListView::currentEditSelectionChanged
void currentEditSelectionChanged(QgsFeature &feat)
Emitted whenever the current edit selection has been changed.
QgsFeatureListView::willShowContextMenu
void willShowContextMenu(QgsActionMenu *menu, const QModelIndex &atIndex)
Emitted when the context menu is created to add the specific actions to it.
QgsFeatureSelectionModel::requestRepaint
void requestRepaint()
Request a repaint of the visible items of connected views.
QgsFeatureListView::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event) override
Definition: qgsfeaturelistview.cpp:236
QgsFeatureListView::layerCache
QgsVectorLayerCache * layerCache()
Returns the layer cache.
Definition: qgsfeaturelistview.cpp:41
QgsFeature
Definition: qgsfeature.h:55
QgsIFeatureSelectionManager
Definition: qgsifeatureselectionmanager.h:31
qgslogger.h
QgsFeatureListViewDelegate
Definition: qgsfeaturelistviewdelegate.h:31
QgsFeatureListModel::mapSelectionFromMaster
virtual QItemSelection mapSelectionFromMaster(const QItemSelection &selection) const
Definition: qgsfeaturelistmodel.cpp:338
QgsFeatureListView::mousePressEvent
void mousePressEvent(QMouseEvent *event) override
Definition: qgsfeaturelistview.cpp:129
QgsFeatureListViewDelegate::EditElement
@ EditElement
Definition: qgsfeaturelistviewdelegate.h:40
QgsFeatureListView::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event) override
Definition: qgsfeaturelistview.cpp:253
QgsFeatureListView::currentEditSelectionProgressChanged
void currentEditSelectionProgressChanged(int progress, int count)
Emitted whenever the current edit selection has been changed.
QgsFeatureListView::aboutToChangeEditSelection
void aboutToChangeEditSelection(bool &ok)
qgsattributetabledelegate.h
QgsFeatureId
qint64 QgsFeatureId
Definition: qgsfeatureid.h:25