QGIS API Documentation  2.6.0-Brighton
 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 
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