QGIS API Documentation  2.3.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 
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:
97 
101 
105 
109 };
110 
111 #endif // QGSFEATURESELECTIONMODEL_H
QgsFeatureIds mDeselectedBuffer
If sync is disabled Holds a list of newly deselected features which will be synced when re-enabled...
static unsigned index
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:326
virtual void select(const QItemSelection &selection, SelectionFlags command)
Overwritten to do NOTHING (we handle selection ourselves)
QgsIFeatureSelectionManager * mFeatureSelectionManager
virtual void select(const QModelIndex &index, SelectionFlags command)
Overwritten to do NOTHING (we handle selection ourselves)
qint64 QgsFeatureId
Definition: qgsfeature.h:30
Is an interface class to abstract feature selection handling.
Represents a vector layer which manages a vector based data sets.
QgsFeatureIds mSelectedBuffer
If sync is disabled Holds a list of newly selected features which will be synced when re-enabled...
bool mClearAndSelectBuffer
If sync is disabled Is set to true, if a clear and select operation should be performed before syncin...