QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 
12 class GUI_EXPORT QgsFeatureSelectionModel : public QItemSelectionModel
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 ) { Q_UNUSED( index ); Q_UNUSED( command ); }
69 
75  virtual void select( const QItemSelection &selection, SelectionFlags command ) { 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
Definition: mersenne-twister.cpp:36
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:325
Definition: qgsfeatureselectionmodel.h:12
virtual void select(const QItemSelection &selection, SelectionFlags command)
Overwritten to do NOTHING (we handle selection ourselves)
Definition: qgsfeatureselectionmodel.h:75
virtual void select(const QModelIndex &index, SelectionFlags command)
Overwritten to do NOTHING (we handle selection ourselves)
Definition: qgsfeatureselectionmodel.h:68
Definition: qgsfeaturemodel.h:7
qint64 QgsFeatureId
Definition: qgsfeature.h:30
Is an interface class to abstract feature selection handling.
Definition: qgsifeatureselectionmanager.h:29
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:470