QGIS API Documentation 3.43.0-Master (b60ef06885e)
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#include "qgis_gui.h"
21
22class QgsVectorLayer;
25class QPosition;
26
32class GUI_EXPORT QgsFeatureListViewDelegate : public QItemDelegate
33{
34 Q_OBJECT
35
36 public:
37 static const int ICON_SIZE = 24;
38
40 {
42 SelectionElement
43 };
44
45 explicit QgsFeatureListViewDelegate( QgsFeatureListModel *listModel, QObject *parent = nullptr );
46
47 void setEditSelectionModel( QItemSelectionModel *editSelectionModel );
48
49 Element positionToElement( QPoint pos );
50
51 void setFeatureSelectionModel( QgsFeatureSelectionModel *featureSelectionModel );
52
53 void setCurrentFeatureEdited( bool state );
54
55 signals:
56
60 void editButtonClicked( QModelIndex &index );
61
62 protected:
63 QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
64 void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
65
66 private:
67 QgsFeatureSelectionModel *mFeatureSelectionModel = nullptr;
68 QItemSelectionModel *mEditSelectionModel = nullptr;
69 QgsFeatureListModel *mListModel = nullptr;
71 bool mCurrentFeatureEdited;
72};
73
74#endif // QGSATTRIBUTELISTVIEWDELEGATE_H
A proxy model for feature lists.
Custom item delegate for feature list views.
void editButtonClicked(QModelIndex &index)
Emitted when the edit button is clicked for the feature with matching index.
Item selection model for selecting features.
Represents a vector layer which manages a vector based dataset.