Class: QgsAttributeTableView

class qgis.gui.QgsAttributeTableView

Bases: QgsTableView

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.

QgsAttributeTableView(parent: QWidget = None) Constructor for QgsAttributeTableView

Methods

actionEvent

changeEvent

childEvent

closeEditor

closeEvent

Saves geometry to the settings on close

columnCountChanged

columnMoved

commitData

connectNotify

contextMenuEvent

Is called when the context menu will be shown.

create

currentChanged

customEvent

dataChanged

destroy

dirtyRegionOffset

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

drawFrame

dropEvent

dropIndicatorPosition

edit

editorDestroyed

enterEvent

event

eventFilter

This event filter is installed on the verticalHeader to intercept mouse press and release events.

executeDelayedItemsLayout

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

horizontalOffset

horizontalScrollbarAction

horizontalScrollbarValueChanged

initPainter

initStyleOption

inputMethodEvent

isIndexHidden

isSignalConnected

keyPressEvent

Called for key press events Disables selection change by only pressing an arrow key

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

Called for mouse move events on a table cell.

mousePressEvent

Called for mouse press events on a table cell.

mouseReleaseEvent

Called for mouse release events on a table cell.

moveCursor

moveEvent

nativeEvent

paintEvent

receivers

repaintRequested

param indexes

resizeEvent

rowCountChanged

rowMoved

rowResized

rowsAboutToBeRemoved

rowsInserted

scheduleDelayedItemsLayout

scrollContentsBy

scrollDirtyRegion

scrollToFeature

Scroll to a feature with a given fid.

selectAll

selectRow

param row

selectedFeaturesIds

Returns the selected features in the attribute table in table sorted order.

selectedIndexes

selectionChanged

selectionCommand

sender

senderSignalIndex

setAttributeTableConfig

Set the attribute table config which should be used to control the appearance of the attribute table.

setDirtyRegion

setFeatureSelectionManager

type featureSelectionManager

QgsIFeatureSelectionManager

setModel

param filterModel

setSelection

setState

setViewportMargins

sharedPainter

showEvent

sizeHintForColumn

sizeHintForRow

startDrag

state

tabletEvent

timerEvent

updateEditorData

updateEditorGeometries

updateGeometries

updateMicroFocus

verticalOffset

verticalScrollbarAction

verticalScrollbarValueChanged

viewOptions

viewportEvent

viewportMargins

viewportSizeHint

visualRegionForSelection

Signals

columnResized

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

finished

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

willShowContextMenu

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEditor(self, QWidget, QAbstractItemDelegate.EndEditHint)
closeEvent(self, event: QCloseEvent)

Saves geometry to the settings on close

Parameters

event (QCloseEvent) – not used

QgsAttributeTableView.columnCountChanged(self, int, int)
QgsAttributeTableView.columnMoved(self, int, int, int)
columnResized

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type

PYQT_SIGNAL

commitData(self, QWidget)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, event: QContextMenuEvent)

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 (QContextMenuEvent) – The associated event object.

create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
QgsAttributeTableView.currentChanged(self, QModelIndex, QModelIndex)
customEvent(self, QEvent)
QgsAttributeTableView.dataChanged(self, QModelIndex, QModelIndex, roles: Iterable[int] = [])
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
dirtyRegionOffset(self) QPoint
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
drawFrame(self, QPainter)
dropEvent(self, QDropEvent)
dropIndicatorPosition(self) QAbstractItemView.DropIndicatorPosition
edit(self, QModelIndex)
edit(self, QModelIndex, QAbstractItemView.EditTrigger, QEvent) bool
editorDestroyed(self, QObject)
enterEvent(self, QEvent)
event(self, QEvent) bool
eventFilter(self, object: QObject, event: QEvent) bool

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 (QObject) – The object which is the target of the event.

  • event (QEvent) – The intercepted event

Return type

bool

Returns

Returns always False, so the event gets processed

executeDelayedItemsLayout(self)
finished

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type

PYQT_SIGNAL

focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hideEvent(self, QHideEvent)
horizontalOffset(self) int
horizontalScrollbarAction(self, int)
horizontalScrollbarValueChanged(self, int)
initPainter(self, QPainter)
initStyleOption(self, QStyleOptionFrame)
inputMethodEvent(self, QInputMethodEvent)
isIndexHidden(self, QModelIndex) bool
isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, event: QKeyEvent)

Called for key press events Disables selection change by only pressing an arrow key

Parameters

event (QKeyEvent) – The mouse event

keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, event: QMouseEvent)

Called for mouse move events on a table cell. Disables selection change for these events.

Parameters

event (QMouseEvent) – The mouse event

mousePressEvent(self, event: QMouseEvent)

Called for mouse press events on a table cell. Disables selection change for these events.

Parameters

event (QMouseEvent) – The mouse event

mouseReleaseEvent(self, event: QMouseEvent)

Called for mouse release events on a table cell. Disables selection change for these events.

Parameters

event (QMouseEvent) – The mouse event

moveCursor(self, QAbstractItemView.CursorAction, Union[Qt.KeyboardModifiers, Qt.KeyboardModifier]) QModelIndex
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) int
repaintRequested(self, indexes: Iterable[QModelIndex])
repaintRequested(self) None
Parameters

indexes (Iterable[QModelIndex]) –

resizeEvent(self, QResizeEvent)
QgsAttributeTableView.rowCountChanged(self, int, int)
QgsAttributeTableView.rowMoved(self, int, int, int)
QgsAttributeTableView.rowResized(self, int, int, int)
QgsAttributeTableView.rowsAboutToBeRemoved(self, QModelIndex, int, int)
QgsAttributeTableView.rowsInserted(self, QModelIndex, int, int)
scheduleDelayedItemsLayout(self)
QgsAttributeTableView.scrollContentsBy(self, int, int)
QgsAttributeTableView.scrollDirtyRegion(self, int, int)
scrollToFeature(self, fid: int, column: int = -1)

Scroll to a feature with a given fid.

Optionally a column can be specified, which will also bring that column into view.

New in version 3.16.

Parameters
  • fid (int) –

  • column (int = -1) –

selectAll(self)
selectRow(self, row: int)
Parameters

row (int) –

selectedFeaturesIds(self) object

Returns the selected features in the attribute table in table sorted order.

Return type

object

Returns

The selected features in the attribute table in the order sorted by the table.

New in version 3.4.

selectedIndexes(self) List[QModelIndex]
QgsAttributeTableView.selectionChanged(self, QItemSelection, QItemSelection)
selectionCommand(self, QModelIndex, event: QEvent = None) QItemSelectionModel.SelectionFlags
sender(self) QObject
senderSignalIndex(self) int
setAttributeTableConfig(self, config: QgsAttributeTableConfig)

Set the attribute table config which should be used to control the appearance of the attribute table.

New in version 2.16.

Parameters

config (QgsAttributeTableConfig) –

setDirtyRegion(self, QRegion)
setFeatureSelectionManager(self, featureSelectionManager: QgsIFeatureSelectionManager)
setFeatureSelectionManager(None) None
Parameters

featureSelectionManager (QgsIFeatureSelectionManager) –

setModel(self, filterModel: QgsAttributeTableFilterModel)
Parameters

filterModel (QgsAttributeTableFilterModel) –

setSelection(self, QRect, Union[QItemSelectionModel.SelectionFlags, QItemSelectionModel.SelectionFlag])
setState(self, QAbstractItemView.State)
QgsAttributeTableView.setViewportMargins(self, int, int, int, int)
setViewportMargins(self, QMargins) None
sharedPainter(self) QPainter
showEvent(self, QShowEvent)
sizeHintForColumn(self, int) int
sizeHintForRow(self, int) int
startDrag(self, Union[Qt.DropActions, Qt.DropAction])
state(self) QAbstractItemView.State
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateEditorData(self)
updateEditorGeometries(self)
updateGeometries(self)
updateMicroFocus(self)
verticalOffset(self) int
verticalScrollbarAction(self, int)
verticalScrollbarValueChanged(self, int)
viewOptions(self) QStyleOptionViewItem
viewportEvent(self, QEvent) bool
viewportMargins(self) QMargins
viewportSizeHint(self) QSize
visualRegionForSelection(self, QItemSelection) QRegion
willShowContextMenu

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type

PYQT_SIGNAL