QGIS API Documentation  2.0.1-Dufour
 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  signals:
36  void editButtonClicked( QModelIndex& index );
37 
38  public slots:
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:
46  QItemSelectionModel* mEditSelectionModel;
48 };
49 
50 #endif // QGSATTRIBUTELISTVIEWDELEGATE_H