QGIS API Documentation  2.11.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsfeatureselectionmodel.h
Go to the documentation of this file.
1 #ifndef QGSFEATURESELECTIONMODEL_H
2 #define QGSFEATURESELECTIONMODEL_H
3 
4 #include <QItemSelectionModel>
5 
6 #include "qgsfeature.h"
7 
8 class QgsVectorLayer;
9 class QgsFeatureModel;
11 
13 {
14  Q_OBJECT
15  public:
16  explicit QgsFeatureSelectionModel( QAbstractItemModel* model, QgsFeatureModel* featureModel, QgsIFeatureSelectionManager* featureSelectionHandler, QObject* parent );
17 
27  void enableSync( bool enable );
28 
37  virtual bool isSelected( QgsFeatureId fid );
45  virtual bool isSelected( const QModelIndex& index );
46 
47  signals:
54  void requestRepaint( QModelIndexList indexes );
55 
60  void requestRepaint();
61 
62  public slots:
68  virtual void select( const QModelIndex &index, SelectionFlags command ) override { Q_UNUSED( index ); Q_UNUSED( command ); }
69 
75  virtual void select( const QItemSelection &selection, SelectionFlags command ) override { Q_UNUSED( selection ); Q_UNUSED( command ); }
76 
83  virtual void selectFeatures( const QItemSelection &selection, SelectionFlags command );
84 
85  virtual void setFeatureSelectionManager( QgsIFeatureSelectionManager* featureSelectionManager );
86 
87  private slots:
88  virtual void layerSelectionChanged( QgsFeatureIds selected, QgsFeatureIds deselected, bool clearAndSelect );
89 
90  private:
91  QModelIndexList expandIndexToRow( const QModelIndex& index ) const;
92 
93  private:
94  QgsFeatureModel* mFeatureModel;
95  QgsIFeatureSelectionManager* mFeatureSelectionManager;
96  bool mSyncEnabled;
97 
100  QgsFeatureIds mSelectedBuffer;
101 
104  QgsFeatureIds mDeselectedBuffer;
105 
108  bool mClearAndSelectBuffer;
109 };
110 
111 #endif // QGSFEATURESELECTIONMODEL_H
static unsigned index
virtual void select(const QModelIndex &index, SelectionFlags command) override
Overwritten to do NOTHING (we handle selection ourselves)
virtual void select(const QItemSelection &selection, SelectionFlags command) override
Overwritten to do NOTHING (we handle selection ourselves)
bool isSelected(const QModelIndex &index) const
qint64 QgsFeatureId
Definition: qgsfeature.h:31
Is an interface class to abstract feature selection handling.
Represents a vector layer which manages a vector based data sets.