QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsattributetabledelegate.h
Go to the documentation of this file.
1 /***************************************************************************
2  QgsAttributeTableDelegate.h
3  --------------------------------------
4  Date : Feb 2009
5  Copyright : (C) 2009 Vita Cizek
6  Email : weetya (at) gmail.com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSATTRIBUTETABLEDELEGATE_H
17 #define QGSATTRIBUTETABLEDELEGATE_H
18 
19 #include <QItemDelegate>
20 #include "qgsfeature.h"
21 
23 class QPainter;
24 class QgsVectorLayer;
26 
32 class GUI_EXPORT QgsAttributeTableDelegate : public QItemDelegate
33 {
34  Q_OBJECT
35 
36  static QgsVectorLayer* layer( const QAbstractItemModel* model );
37  static const QgsAttributeTableModel* masterModel( const QAbstractItemModel* model );
38 
39  public:
43  QgsAttributeTableDelegate( QObject* parent = NULL ) :
44  QItemDelegate( parent ) {}
45 
48  QWidget * createEditor(
49  QWidget *parent,
50  const QStyleOptionViewItem &option,
51  const QModelIndex &index ) const;
52 
54  void paint(
55  QPainter * painter,
56  const QStyleOptionViewItem & option,
57  const QModelIndex & index ) const;
58 
65  void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const;
66 
72  void setEditorData( QWidget *editor, const QModelIndex &index ) const;
73 
74  void setFeatureSelectionModel( QgsFeatureSelectionModel* featureSelectionModel );
75 
76  private:
77  QgsFeatureSelectionModel* mFeatureSelectionModel;
78 };
79 
80 #endif //QGSATTRIBUTETABLEDELEGATE_H