QGIS API Documentation  2.14.0-Essen
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;
34 
35 
44 class GUI_EXPORT QgsAttributeTableView : public QTableView
45 {
46  Q_OBJECT
47 
48  public:
49  QgsAttributeTableView( QWidget* parent = nullptr );
50  virtual ~QgsAttributeTableView();
51 
52  virtual void setModel( QgsAttributeTableFilterModel* filterModel );
53 
58  void setFeatureSelectionManager( QgsIFeatureSelectionManager* featureSelectionManager );
59 
70  virtual bool eventFilter( QObject* object, QEvent* event ) override;
71 
72  protected:
79  void mousePressEvent( QMouseEvent *event ) override;
80 
87  void mouseReleaseEvent( QMouseEvent *event ) override;
88 
95  void mouseMoveEvent( QMouseEvent *event ) override;
96 
103  void keyPressEvent( QKeyEvent *event ) override;
104 
112  void contextMenuEvent( QContextMenuEvent* event ) override;
113 
118  void closeEvent( QCloseEvent *event ) override;
119 
120  signals:
129  void willShowContextMenu( QMenu* menu, const QModelIndex& atIndex );
130 
131  void finished();
132 
133  public slots:
134  void repaintRequested( const QModelIndexList& indexes );
135  void repaintRequested();
136  virtual void selectAll() override;
137  virtual void selectRow( int row );
138  virtual void _q_selectRow( int row );
139 
140  private slots:
141  void modelDeleted();
142  void showHorizontalSortIndicator();
143 
144  private:
145  void selectRow( int row, bool anchor );
146  QgsAttributeTableModel* mMasterModel;
147  QgsAttributeTableFilterModel* mFilterModel;
148  QgsFeatureSelectionModel* mFeatureSelectionModel;
149  QgsIFeatureSelectionManager* mFeatureSelectionManager;
150  QgsAttributeTableDelegate* mTableDelegate;
151  QAbstractItemModel* mModel; // Most likely the filter model
152  QMenu *mActionPopup;
153  QgsVectorLayerCache* mLayerCache;
154  int mRowSectionAnchor;
155  QItemSelectionModel::SelectionFlag mCtrlDragSelectionFlag;
156 };
157 
158 #endif
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...
virtual void mouseReleaseEvent(QMouseEvent *event)
virtual void contextMenuEvent(QContextMenuEvent *e)
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:105
virtual void setModel(QAbstractItemModel *model)
virtual bool eventFilter(QObject *watched, QEvent *event)
This class caches features of a given QgsVectorLayer.
virtual void mouseMoveEvent(QMouseEvent *event)
virtual void selectAll()
virtual void mousePressEvent(QMouseEvent *event)
A delegate item class for QgsAttributeTable (see Qt documentation for QItemDelegate).
virtual void keyPressEvent(QKeyEvent *event)
virtual void closeEvent(QCloseEvent *event)
Is an interface class to abstract feature selection handling.
Represents a vector layer which manages a vector based data sets.
void selectRow(int row)