QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgsattributetableview.h
Go to the documentation of this file.
1/***************************************************************************
2 QgsAttributeTableView.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 QGSATTRIBUTETABLEVIEW_H
17#define QGSATTRIBUTETABLEVIEW_H
18
19#include <QAction>
20#include "qgsfeatureid.h"
21#include "qgstableview.h"
22
23#include "qgis_gui.h"
25
31class QgsMapCanvas;
32class QgsVectorLayer;
34class QMenu;
35class QProgressDialog;
37class QgsFeature;
38
48class GUI_EXPORT QgsAttributeTableView : public QgsTableView
49{
50 Q_OBJECT
51
52 public:
54 QgsAttributeTableView( QWidget *parent SIP_TRANSFERTHIS = nullptr );
55
56#ifdef __clang__
57#pragma clang diagnostic push
58#pragma clang diagnostic ignored "-Woverloaded-virtual"
59#endif
60 virtual void setModel( QgsAttributeTableFilterModel *filterModel );
61#ifdef __clang__
62#pragma clang diagnostic pop
63#endif
64
69 void setFeatureSelectionManager( QgsIFeatureSelectionManager *featureSelectionManager );
70
81 bool eventFilter( QObject *object, QEvent *event ) override;
82
87 void setAttributeTableConfig( const QgsAttributeTableConfig &config );
88
94 QList<QgsFeatureId> selectedFeaturesIds() const;
95
103 void scrollToFeature( const QgsFeatureId &fid, int column = -1 );
104
110 void closeCurrentEditor();
111
112 protected:
119 void mousePressEvent( QMouseEvent *event ) override;
120
127 void mouseReleaseEvent( QMouseEvent *event ) override;
128
135 void mouseMoveEvent( QMouseEvent *event ) override;
136
143 void keyPressEvent( QKeyEvent *event ) override;
144
152 void contextMenuEvent( QContextMenuEvent *event ) override;
153
158 void closeEvent( QCloseEvent *event ) override;
159
160 signals:
161
169 void willShowContextMenu( QMenu *menu, const QModelIndex &atIndex );
170
176 void columnResized( int column, int width );
177
181 Q_DECL_DEPRECATED void finished() SIP_DEPRECATED;
182
183 public slots:
184 void repaintRequested( const QModelIndexList &indexes );
185 void repaintRequested();
186 void selectAll() override;
187 virtual void selectRow( int row );
188 virtual void _q_selectRow( int row );
189
190 private slots:
191 void modelDeleted();
192 void showHorizontalSortIndicator();
193 void actionTriggered();
194 void columnSizeChanged( int index, int oldWidth, int newWidth );
195 void onActionColumnItemPainted( const QModelIndex &index );
196 void recreateActionWidgets();
197
198 private:
199 void updateActionImage( QWidget *widget );
200 QWidget *createActionWidget( QgsFeatureId fid );
201
202 void selectRow( int row, bool anchor );
203 QgsAttributeTableFilterModel *mFilterModel = nullptr;
204 QgsFeatureSelectionModel *mFeatureSelectionModel = nullptr;
205 QgsIFeatureSelectionManager *mOwnedFeatureSelectionManager = nullptr;
206 QgsIFeatureSelectionManager *mFeatureSelectionManager = nullptr;
207 QgsAttributeTableDelegate *mTableDelegate = nullptr;
208 QMenu *mActionPopup = nullptr;
209 int mRowSectionAnchor = 0;
210 QItemSelectionModel::SelectionFlag mCtrlDragSelectionFlag = QItemSelectionModel::Select;
211 QMap<QModelIndex, QWidget *> mActionWidgets;
213 QString mSortExpression;
214};
215
216#endif
This is a container for configuration of the attribute table.
A delegate item class for QgsAttributeTable (see Qt documentation for QItemDelegate).
A model backed by a QgsVectorLayerCache which is able to provide feature/attribute information to a Q...
Provides a table view of features of a QgsVectorLayer.
void willShowContextMenu(QMenu *menu, const QModelIndex &atIndex)
Emitted in order to provide a hook to add additional* menu entries to the context menu.
Q_DECL_DEPRECATED void finished()
void columnResized(int column, int width)
Emitted when a column in the view has been resized.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
Is an interface class to abstract feature selection handling.
Map canvas is a class for displaying all GIS data types on a canvas.
A QTableView subclass with QGIS specific tweaks and improvements.
This class caches features of a given QgsVectorLayer.
Represents a vector layer which manages a vector based data sets.
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features