QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsfeaturelistviewdelegate.h
Go to the documentation of this file.
1 #ifndef QGSATTRIBUTELISTVIEWDELEGATE_H
2 #define QGSATTRIBUTELISTVIEWDELEGATE_H
3 
4 #include <QItemDelegate>
5 #include <QItemSelectionModel>
6 
7 #include "qgsfeature.h"
8 
9 class QgsVectorLayer;
12 class QPosition;
13 
14 class GUI_EXPORT QgsFeatureListViewDelegate : public QItemDelegate
15 {
16  Q_OBJECT
17 
18  public:
19  static int const sIconSize = 24;
20 
21  enum Element
22  {
24  SelectionElement
25  };
26 
27  explicit QgsFeatureListViewDelegate( QgsFeatureListModel* listModel, QObject *parent = 0 );
28 
29  void setEditSelectionModel( QItemSelectionModel* editSelectionModel );
30 
31  Element positionToElement( const QPoint& pos );
32 
33  void setFeatureSelectionModel( QgsFeatureSelectionModel* featureSelectionModel );
34 
35  void setCurrentFeatureEdited( bool state );
36 
37  signals:
38  void editButtonClicked( QModelIndex& index );
39 
40  protected:
41  virtual QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const;
42  virtual void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
43 
44  private:
45  QgsFeatureSelectionModel* mFeatureSelectionModel;
46  QItemSelectionModel* mEditSelectionModel;
47  QgsFeatureListModel* mListModel;
49  bool mCurrentFeatureEdited;
50 };
51 
52 #endif // QGSATTRIBUTELISTVIEWDELEGATE_H