QGIS API Documentation  2.15.0-Master (af20121)
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 
51  virtual void setModel( QgsAttributeTableFilterModel* filterModel );
52 
57  void setFeatureSelectionManager( QgsIFeatureSelectionManager* featureSelectionManager );
58 
69  virtual bool eventFilter( QObject* object, QEvent* event ) override;
70 
71  protected:
78  void mousePressEvent( QMouseEvent *event ) override;
79 
86  void mouseReleaseEvent( QMouseEvent *event ) override;
87 
94  void mouseMoveEvent( QMouseEvent *event ) override;
95 
102  void keyPressEvent( QKeyEvent *event ) override;
103 
111  void contextMenuEvent( QContextMenuEvent* event ) override;
112 
117  void closeEvent( QCloseEvent *event ) override;
118 
119  signals:
128  void willShowContextMenu( QMenu* menu, const QModelIndex& atIndex );
129 
130  void finished();
131 
132  public slots:
133  void repaintRequested( const QModelIndexList& indexes );
134  void repaintRequested();
135  virtual void selectAll() override;
136  virtual void selectRow( int row );
137  virtual void _q_selectRow( int row );
138 
139  private slots:
140  void modelDeleted();
141  void showHorizontalSortIndicator();
142  void actionTriggered();
143  void columnSizeChanged( int index, int oldWidth, int newWidth );
144 
145  private:
146  void updateActionImage( QWidget* widget );
147  QWidget* createActionWidget( QgsFeatureId fid );
148 
149  void selectRow( int row, bool anchor );
150  QgsAttributeTableModel* mMasterModel;
151  QgsAttributeTableFilterModel* mFilterModel;
152  QgsFeatureSelectionModel* mFeatureSelectionModel;
153  QgsIFeatureSelectionManager* mFeatureSelectionManager;
154  QgsAttributeTableDelegate* mTableDelegate;
155  QAbstractItemModel* mModel; // Most likely the filter model
156  QMenu *mActionPopup;
157  int mRowSectionAnchor;
158  QItemSelectionModel::SelectionFlag mCtrlDragSelectionFlag;
159  QWidget* mActionWidget;
160 };
161 
162 #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...
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:108
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).
qint64 QgsFeatureId
Definition: qgsfeature.h:31
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)