QGIS API Documentation  2.99.0-Master (6a61179)
qgsfeaturelistviewdelegate.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfeaturelistviewdelegate.h
3  ---------------------
4  begin : February 2013
5  copyright : (C) 2013 by Matthias Kuhn
6  email : matthias at opengis dot ch
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 #ifndef QGSATTRIBUTELISTVIEWDELEGATE_H
16 #define QGSATTRIBUTELISTVIEWDELEGATE_H
17 
18 #include <QItemDelegate>
19 #include <QItemSelectionModel>
20 
21 class QgsVectorLayer;
24 class QPosition;
25 
29 class GUI_EXPORT QgsFeatureListViewDelegate : public QItemDelegate
30 {
31  Q_OBJECT
32 
33  public:
34  static int const sIconSize = 24;
35 
36  enum Element
37  {
39  SelectionElement
40  };
41 
42  explicit QgsFeatureListViewDelegate( QgsFeatureListModel* listModel, QObject *parent = nullptr );
43 
44  void setEditSelectionModel( QItemSelectionModel* editSelectionModel );
45 
46  Element positionToElement( QPoint pos );
47 
48  void setFeatureSelectionModel( QgsFeatureSelectionModel* featureSelectionModel );
49 
50  void setCurrentFeatureEdited( bool state );
51 
52  signals:
53  void editButtonClicked( QModelIndex& index );
54 
55  protected:
56  virtual QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const override;
57  virtual void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const override;
58 
59  private:
60  QgsFeatureSelectionModel* mFeatureSelectionModel;
61  QItemSelectionModel* mEditSelectionModel;
62  QgsFeatureListModel* mListModel;
64  bool mCurrentFeatureEdited;
65 };
66 
67 #endif // QGSATTRIBUTELISTVIEWDELEGATE_H
static unsigned index
Represents a vector layer which manages a vector based data sets.