QGIS API Documentation  2.2.0-Valmiera
 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  protected:
39  virtual QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const;
40  virtual void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
41 
42  private:
44  QItemSelectionModel* mEditSelectionModel;
46 };
47 
48 #endif // QGSATTRIBUTELISTVIEWDELEGATE_H