Class: QgsAttributeTableView¶
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.
Class Hierarchy¶
Base classes¶
A QTableView subclass with QGIS specific tweaks and improvements. |
|
Methods
Closes the editor delegate for the current item, committing its changes to the model. |
|
Saves geometry to the settings on close |
|
Is called when the context menu will be shown. |
|
This event filter is installed on the verticalHeader to intercept mouse press and release events. |
|
Called for key press events Disables selection change by only pressing an arrow key |
|
Called for mouse move events on a table cell. |
|
Called for mouse press events on a table cell. |
|
Called for mouse release events on a table cell. |
|
Scroll to a feature with a given fid. |
|
Returns the selected features in the attribute table in table sorted order. |
|
Set the attribute table config which should be used to control the appearance of the attribute table. |
|
setFeatureSelectionManager |
Signals
Emitted when a column in the view has been resized. |
|
Emitted in order to provide a hook to add additional* menu entries to the context menu. |
- class qgis.gui.QgsAttributeTableView[source]¶
Bases:
QgsTableView
- __init__(parent: QWidget | None = None)
Constructor for QgsAttributeTableView
- Parameters:
parent (Optional[QWidget] = None)
- closeCurrentEditor(self)[source]¶
Closes the editor delegate for the current item, committing its changes to the model.
Added in version 3.30.
- closeEvent(self, event: QCloseEvent | None)[source]¶
Saves geometry to the settings on close
- Parameters:
event (Optional[QCloseEvent]) – not used
- signal columnResized(column: int, width: int)[source]¶
Emitted when a column in the view has been resized.
- Parameters:
column (int) – column index (starts at 0)
width (int) – new width in pixel
- contextMenuEvent(self, event: QContextMenuEvent | None)[source]¶
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.- Parameters:
event (Optional[QContextMenuEvent]) – The associated event object.
- eventFilter(self, object: QObject | None, event: QEvent | None) bool [source]¶
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.
- Parameters:
object (Optional[QObject]) – The object which is the target of the event.
event (Optional[QEvent]) – The intercepted event
- Return type:
bool
- Returns:
Returns always
False
, so the event gets processed
- keyPressEvent(self, event: QKeyEvent | None)[source]¶
Called for key press events Disables selection change by only pressing an arrow key
- Parameters:
event (Optional[QKeyEvent]) – The mouse event
- mouseMoveEvent(self, event: QMouseEvent | None)[source]¶
Called for mouse move events on a table cell. Disables selection change for these events.
- Parameters:
event (Optional[QMouseEvent]) – The mouse event
- mousePressEvent(self, event: QMouseEvent | None)[source]¶
Called for mouse press events on a table cell. Disables selection change for these events.
- Parameters:
event (Optional[QMouseEvent]) – The mouse event
- mouseReleaseEvent(self, event: QMouseEvent | None)[source]¶
Called for mouse release events on a table cell. Disables selection change for these events.
- Parameters:
event (Optional[QMouseEvent]) – The mouse event
- repaintRequested(self, indexes: Iterable[QModelIndex])[source]¶
- repaintRequested(self) None
- Parameters:
indexes (Iterable[QModelIndex])
- repaintRequested(self)[source]
- scrollToFeature(self, fid: int, column: int = -1)[source]¶
Scroll to a feature with a given
fid
.Optionally a
column
can be specified, which will also bring that column into view.Added in version 3.16.
- Parameters:
fid (int)
column (int = -1)
- selectedFeaturesIds(self) List[int] ¶
Returns the selected features in the attribute table in table sorted order.
- Return type:
List[int]
- Returns:
The selected features in the attribute table in the order sorted by the table.
Added in version 3.4.
- setAttributeTableConfig(self, config: QgsAttributeTableConfig)[source]¶
Set the attribute table config which should be used to control the appearance of the attribute table.
- Parameters:
config (QgsAttributeTableConfig)
- setFeatureSelectionManager(self, featureSelectionManager: QgsIFeatureSelectionManager | None)[source]¶
- setFeatureSelectionManager(None) None
- Parameters:
featureSelectionManager (Optional[QgsIFeatureSelectionManager])
- signal willShowContextMenu(menu: QMenu, atIndex: QModelIndex)[source]¶
Emitted in order to provide a hook to add additional* menu entries to the context menu.
- Parameters:
menu (QMenu) – If additional QMenuItems are added, they will show up in the context menu.
atIndex (QModelIndex) – The QModelIndex, to which the context menu belongs. Relative to the source model. In most cases, this will be a
QgsAttributeTableFilterModel