QGIS API Documentation  2.0.1-Dufour
 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;
10 
11 class GUI_EXPORT QgsFeatureSelectionModel : public QItemSelectionModel
12 {
13  Q_OBJECT
14  public:
15  explicit QgsFeatureSelectionModel( QAbstractItemModel* model, QgsFeatureModel* featureModel, QgsVectorLayer* layer, QObject* parent );
16 
26  void enableSync( bool enable );
27 
36  virtual bool isSelected( QgsFeatureId fid );
44  virtual bool isSelected( const QModelIndex& index );
45 
46  signals:
53  void requestRepaint( QModelIndexList indexes );
54 
59  void requestRepaint();
60 
61  public slots:
67  virtual void select( const QModelIndex &index, SelectionFlags command ) { Q_UNUSED( index ); Q_UNUSED( command ); }
68 
74  virtual void select( const QItemSelection &selection, SelectionFlags command ) { Q_UNUSED( selection ); Q_UNUSED( command ); }
75 
82  virtual void selectFeatures( const QItemSelection &selection, SelectionFlags command );
83 
84  private slots:
85  virtual void layerSelectionChanged( QgsFeatureIds selected, QgsFeatureIds deselected, bool clearAndSelect );
86 
87  private:
88  QModelIndexList expandIndexToRow( const QModelIndex& index ) const;
89 
90  private:
97 };
98 
99 #endif // QGSFEATURESELECTIONMODEL_H