Class: QgsRasterAttributeTableWidget

class qgis.gui.QgsRasterAttributeTableWidget

Bases: QgsPanelWidget

The QgsRasterAttributeTableWidget class provides an attribute table for rasters and methods to edit the table.

New in version 3.30.

QgsRasterAttributeTableWidget(parent: QWidget = None, rasterLayer: QgsRasterLayer = None, bandNumber: int = 0) Creates a new QgsRasterAttributeTableWidget

actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) bool
focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isDirty(self) bool

Returns True if the associated raster attribute table is dirty

Return type:


isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, event: QKeyEvent)

Overridden key press event to handle the esc event on the widget.


event – The key event

keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) int

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.

  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:


resizeEvent(self, QResizeEvent)

Save the changes in the raster attribute table.

sender(self) QObject
senderSignalIndex(self) int
setDockMode(self, dockMode: bool)

dockMode (bool) –

setEditable(self, editable: bool, allowCancel: bool = True) bool

Set the editable state, it may trigger save changes if the attribute table has unsave changes.

  • editable (bool) – editable state

  • allowCancel (bool = True) – optional (default True) flag to show cancel option in confirm save dialog.

Return type:


setMessageBar(self, bar: QgsMessageBar)

Sets the message bar associated with the widget. This allows the widget to push feedback messages to the appropriate message bar.


bar (QgsMessageBar) –

setRasterLayer(self, rasterLayer: QgsRasterLayer, bandNumber: int = 0)

Sets the raster layer and an optional band number.

  • rasterLayer (QgsRasterLayer) – raster layer

  • bandNumber (int = 0) – optional initial selected band number (default to 0, which makes the widget use the first available RAT, if any)

sharedPainter(self) QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
wheelEvent(self, QWheelEvent)