QGIS API Documentation  2.99.0-Master (6a61179)
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 <QTableView>
20 #include <QAction>
21 
22 #include "qgsfeature.h" // For QgsFeatureIds
23 
29 class QgsMapCanvas;
30 class QgsVectorLayer;
32 class QMenu;
33 class QProgressDialog;
35 
44 class GUI_EXPORT QgsAttributeTableView : public QTableView
45 {
46  Q_OBJECT
47 
48  public:
49  QgsAttributeTableView( QWidget* parent = nullptr );
50 
51  virtual void setModel( QgsAttributeTableFilterModel* filterModel );
52 
57  void setFeatureSelectionManager( QgsIFeatureSelectionManager* featureSelectionManager );
58 
69  virtual bool eventFilter( QObject* object, QEvent* event ) override;
70 
76  void setAttributeTableConfig( const QgsAttributeTableConfig& config );
77 
78  protected:
79 
86  void mousePressEvent( QMouseEvent *event ) override;
87 
94  void mouseReleaseEvent( QMouseEvent *event ) override;
95 
102  void mouseMoveEvent( QMouseEvent *event ) override;
103 
110  void keyPressEvent( QKeyEvent *event ) override;
111 
119  void contextMenuEvent( QContextMenuEvent* event ) override;
120 
125  void closeEvent( QCloseEvent *event ) override;
126 
127  signals:
128 
137  void willShowContextMenu( QMenu* menu, const QModelIndex& atIndex );
138 
144  void columnResized( int column, int width );
145 
146  void finished();
147 
148  public slots:
149  void repaintRequested( const QModelIndexList& indexes );
150  void repaintRequested();
151  virtual void selectAll() override;
152  virtual void selectRow( int row );
153  virtual void _q_selectRow( int row );
154 
155  private slots:
156  void modelDeleted();
157  void showHorizontalSortIndicator();
158  void actionTriggered();
159  void columnSizeChanged( int index, int oldWidth, int newWidth );
160  void onActionColumnItemPainted( const QModelIndex& index );
161  void recreateActionWidgets();
162 
163  private:
164  void updateActionImage( QWidget* widget );
165  QWidget* createActionWidget( QgsFeatureId fid );
166 
167  void selectRow( int row, bool anchor );
168  QgsAttributeTableFilterModel* mFilterModel;
169  QgsFeatureSelectionModel* mFeatureSelectionModel;
170  QgsIFeatureSelectionManager* mFeatureSelectionManager;
171  QgsAttributeTableDelegate* mTableDelegate;
172  QMenu *mActionPopup;
173  int mRowSectionAnchor;
174  QItemSelectionModel::SelectionFlag mCtrlDragSelectionFlag;
175  QMap< QModelIndex, QWidget* > mActionWidgets;
176 };
177 
178 #endif
static unsigned index
Provides a table view of features of a QgsVectorLayer.
A model backed by a QgsVectorLayerCache which is able to provide feature/attribute information to a Q...
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:106
This class caches features of a given QgsVectorLayer.
A delegate item class for QgsAttributeTable (see Qt documentation for QItemDelegate).
qint64 QgsFeatureId
Definition: qgsfeature.h:32
This is a container for configuration of the attribute table.
Is an interface class to abstract feature selection handling.
Represents a vector layer which manages a vector based data sets.