|
QGIS API Documentation
master-59fd5e0
|
Provides a table view of features of a QgsVectorLayer. More...
#include <qgsattributetableview.h>
Collaboration diagram for QgsAttributeTableView:Public Slots | |
| virtual void | _q_selectRow (int row) |
| void | repaintRequested (QModelIndexList indexes) |
| void | repaintRequested () |
| virtual void | selectAll () |
| virtual void | selectRow (int row) |
Signals | |
| void | finished () |
| void | willShowContextMenu (QMenu *menu, QModelIndex atIndex) |
| Is emitted, in order to provide a hook to add aditional menu entries to the context menu. | |
Public Member Functions | |
| QgsAttributeTableView (QWidget *parent=0) | |
| virtual | ~QgsAttributeTableView () |
| virtual bool | eventFilter (QObject *object, QEvent *event) |
| This event filter is installed on the verticalHeader to intercept mouse press and release events. | |
| void | setCanvasAndLayerCache (QgsMapCanvas *canvas, QgsVectorLayerCache *layerCache) |
| Autocreates the models. | |
| virtual void | setModel (QgsAttributeTableFilterModel *filterModel) |
Protected Member Functions | |
| void | closeEvent (QCloseEvent *event) |
| Saves geometry to the settings on close. | |
| void | contextMenuEvent (QContextMenuEvent *event) |
| Is called when the context menu will be shown. | |
| void | keyPressEvent (QKeyEvent *event) |
| Called for key press events Disables selection change by only pressing an arrow key. | |
| void | mouseMoveEvent (QMouseEvent *event) |
| Called for mouse move events on a table cell. | |
| void | mousePressEvent (QMouseEvent *event) |
| Called for mouse press events on a table cell. | |
| void | mouseReleaseEvent (QMouseEvent *event) |
| Called for mouse release events on a table cell. | |
Private Member Functions | |
| void | selectRow (int row, bool anchor) |
Private Attributes | |
| QMenu * | mActionPopup |
| QItemSelectionModel::SelectionFlag | mCtrlDragSelectionFlag |
| QgsFeatureSelectionModel * | mFeatureSelectionModel |
| QgsAttributeTableFilterModel * | mFilterModel |
| QgsVectorLayerCache * | mLayerCache |
| QgsAttributeTableModel * | mMasterModel |
| QAbstractItemModel * | mModel |
| int | mRowSectionAnchor |
| QgsAttributeTableDelegate * | mTableDelegate |
Provides a table view of features of a QgsVectorLayer.
This can either be used as a standalone widget. QgsBrowser features a reference implementation. Or this can be used within the QgsDualView stacked widget.
Definition at line 42 of file qgsattributetableview.h.
| QgsAttributeTableView::QgsAttributeTableView | ( | QWidget * | parent = 0 | ) |
Definition at line 32 of file qgsattributetableview.cpp.
References _q_selectRow(), mTableDelegate, and selectRow().
| QgsAttributeTableView::~QgsAttributeTableView | ( | ) | [virtual] |
Definition at line 58 of file qgsattributetableview.cpp.
References mActionPopup.
| void QgsAttributeTableView::_q_selectRow | ( | int | row | ) | [virtual, slot] |
Definition at line 241 of file qgsattributetableview.cpp.
References selectRow().
Referenced by QgsAttributeTableView().
| void QgsAttributeTableView::closeEvent | ( | QCloseEvent * | event | ) | [protected] |
Saves geometry to the settings on close.
| event | not used |
Definition at line 135 of file qgsattributetableview.cpp.
| void QgsAttributeTableView::contextMenuEvent | ( | QContextMenuEvent * | event | ) | [protected] |
Is called when the context menu will be shown.
Emits a willShowContextMenu signal, so the menu can be populated by other parts of the application.
| event | The associated event object. |
Definition at line 205 of file qgsattributetableview.cpp.
References QgsAttributeTableFilterModel::layer(), mActionPopup, mFilterModel, selectAll(), tr, and willShowContextMenu().
| bool QgsAttributeTableView::eventFilter | ( | QObject * | object, |
| QEvent * | event | ||
| ) | [virtual] |
This event filter is installed on the verticalHeader to intercept mouse press and release events.
These are used to disable / enable live synchronisation with the map canvas selection which can be slow due to recurring canvas repaints. Updating the
| object | The object which is the target of the event. |
| event | The intercepted event |
Definition at line 89 of file qgsattributetableview.cpp.
References QgsFeatureSelectionModel::enableSync(), and mFeatureSelectionModel.
| void QgsAttributeTableView::finished | ( | ) | [signal] |
| void QgsAttributeTableView::keyPressEvent | ( | QKeyEvent * | event | ) | [protected] |
Called for key press events Disables selection change by only pressing an arrow key.
| event | The mouse event |
Definition at line 163 of file qgsattributetableview.cpp.
| void QgsAttributeTableView::mouseMoveEvent | ( | QMouseEvent * | event | ) | [protected] |
Called for mouse move events on a table cell.
Disables selection change for these events.
| event | The mouse event |
Definition at line 156 of file qgsattributetableview.cpp.
| void QgsAttributeTableView::mousePressEvent | ( | QMouseEvent * | event | ) | [protected] |
Called for mouse press events on a table cell.
Disables selection change for these events.
| event | The mouse event |
Definition at line 142 of file qgsattributetableview.cpp.
| void QgsAttributeTableView::mouseReleaseEvent | ( | QMouseEvent * | event | ) | [protected] |
Called for mouse release events on a table cell.
Disables selection change for these events.
| event | The mouse event |
Definition at line 149 of file qgsattributetableview.cpp.
| void QgsAttributeTableView::repaintRequested | ( | QModelIndexList | indexes | ) | [slot] |
Definition at line 185 of file qgsattributetableview.cpp.
| void QgsAttributeTableView::repaintRequested | ( | ) | [slot] |
Definition at line 193 of file qgsattributetableview.cpp.
Referenced by setCanvasAndLayerCache(), and setModel().
| void QgsAttributeTableView::selectAll | ( | ) | [virtual, slot] |
Definition at line 198 of file qgsattributetableview.cpp.
References mFeatureSelectionModel, mFilterModel, and QgsFeatureSelectionModel::selectFeatures().
Referenced by contextMenuEvent().
| void QgsAttributeTableView::selectRow | ( | int | row | ) | [virtual, slot] |
Definition at line 236 of file qgsattributetableview.cpp.
Referenced by _q_selectRow(), and QgsAttributeTableView().
| void QgsAttributeTableView::selectRow | ( | int | row, |
| bool | anchor | ||
| ) | [private] |
Definition at line 246 of file qgsattributetableview.cpp.
References QgsFeatureSelectionModel::isSelected(), mCtrlDragSelectionFlag, mFeatureSelectionModel, mRowSectionAnchor, and QgsFeatureSelectionModel::selectFeatures().
| void QgsAttributeTableView::setCanvasAndLayerCache | ( | QgsMapCanvas * | canvas, |
| QgsVectorLayerCache * | layerCache | ||
| ) |
Autocreates the models.
| layerCache | The QgsVectorLayerCache to use ( as backend ) |
| canvas | The QgsMapCanvas to use ( for the currently visible features filter ) |
Definition at line 66 of file qgsattributetableview.cpp.
References QgsVectorLayerCache::layer(), QgsAttributeTableModel::loadLayer(), mFeatureSelectionModel, mFilterModel, mLayerCache, mMasterModel, repaintRequested(), and setModel().
| void QgsAttributeTableView::setModel | ( | QgsAttributeTableFilterModel * | filterModel | ) | [virtual] |
Definition at line 110 of file qgsattributetableview.cpp.
References QgsAttributeTableFilterModel::layer(), mFeatureSelectionModel, mFilterModel, mTableDelegate, repaintRequested(), and QgsAttributeTableDelegate::setFeatureSelectionModel().
Referenced by setCanvasAndLayerCache().
| void QgsAttributeTableView::willShowContextMenu | ( | QMenu * | menu, |
| QModelIndex | atIndex | ||
| ) | [signal] |
Is emitted, in order to provide a hook to add aditional menu entries to the context menu.
| menu | If additional QMenuItems are added, they will show up in the context menu. |
| atIndex | The QModelIndex, to which the context menu belongs. Relative to the source model. In most cases, this will be a QgsAttributeTableFilterModel |
Referenced by contextMenuEvent().
QMenu* QgsAttributeTableView::mActionPopup [private] |
Definition at line 148 of file qgsattributetableview.h.
Referenced by contextMenuEvent(), and ~QgsAttributeTableView().
QItemSelectionModel::SelectionFlag QgsAttributeTableView::mCtrlDragSelectionFlag [private] |
Definition at line 151 of file qgsattributetableview.h.
Referenced by selectRow().
Definition at line 145 of file qgsattributetableview.h.
Referenced by eventFilter(), selectAll(), selectRow(), setCanvasAndLayerCache(), and setModel().
Definition at line 144 of file qgsattributetableview.h.
Referenced by contextMenuEvent(), selectAll(), setCanvasAndLayerCache(), and setModel().
Definition at line 149 of file qgsattributetableview.h.
Referenced by setCanvasAndLayerCache().
Definition at line 143 of file qgsattributetableview.h.
Referenced by setCanvasAndLayerCache().
QAbstractItemModel* QgsAttributeTableView::mModel [private] |
Definition at line 147 of file qgsattributetableview.h.
int QgsAttributeTableView::mRowSectionAnchor [private] |
Definition at line 150 of file qgsattributetableview.h.
Referenced by selectRow().
Definition at line 146 of file qgsattributetableview.h.
Referenced by QgsAttributeTableView(), and setModel().