QGIS API Documentation  3.0.2-Girona (307d082)
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 "qgis_sip.h"
21 #include "qgis_gui.h"
22 
24 class QPainter;
25 class QgsVectorLayer;
27 class QToolButton;
28 
35 class GUI_EXPORT QgsAttributeTableDelegate : public QItemDelegate
36 {
37  Q_OBJECT
38 
39  static QgsVectorLayer *layer( const QAbstractItemModel *model );
40  static const QgsAttributeTableModel *masterModel( const QAbstractItemModel *model );
41 
42  public:
43 
48  QgsAttributeTableDelegate( QObject *parent SIP_TRANSFERTHIS = nullptr )
49  : QItemDelegate( parent )
50  {
51  }
52 
57  QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
58 
62  void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
63 
70  void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
71 
77  void setEditorData( QWidget *editor, const QModelIndex &index ) const override;
78 
79  void setFeatureSelectionModel( QgsFeatureSelectionModel *featureSelectionModel );
80 
81  signals:
82 
91  void actionColumnItemPainted( const QModelIndex &index ) const;
92 
93  private:
94  QgsVectorLayer *mLayer = nullptr;
95  QgsFeatureSelectionModel *mFeatureSelectionModel = nullptr;
96 };
97 
98 #endif //QGSATTRIBUTETABLEDELEGATE_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
A model backed by a QgsVectorLayerCache which is able to provide feature/attribute information to a Q...
QgsAttributeTableDelegate(QObject *parent=nullptr)
Constructor.
A delegate item class for QgsAttributeTable (see Qt documentation for QItemDelegate).
Represents a vector layer which manages a vector based data sets.