QGIS API Documentation  2.10.1-Pisa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 = 0 );
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, QModelIndex atIndex );
130 
131  void finished();
132 
133  public slots:
134  void repaintRequested( 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 
143  private:
144  void selectRow( int row, bool anchor );
145  QgsAttributeTableModel* mMasterModel;
146  QgsAttributeTableFilterModel* mFilterModel;
147  QgsFeatureSelectionModel* mFeatureSelectionModel;
148  QgsIFeatureSelectionManager* mFeatureSelectionManager;
149  QgsAttributeTableDelegate* mTableDelegate;
150  QAbstractItemModel* mModel; // Most likely the filter model
151  QMenu *mActionPopup;
152  QgsVectorLayerCache* mLayerCache;
153  int mRowSectionAnchor;
154  QItemSelectionModel::SelectionFlag mCtrlDragSelectionFlag;
155 };
156 
157 #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)