Class: QgsRasterAttributeTableWidget

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

Added in version 3.30.

QgsRasterAttributeTableWidget

QgsRasterAttributeTableWidget

Class Hierarchy

Inheritance diagram of qgis.gui.QgsRasterAttributeTableWidget

Base classes

QgsPanelWidget

Base class for any widget that can be shown as an inline panel.

QWidget

QObject

QPaintDevice

class qgis.gui.QgsRasterAttributeTableWidget[source]

Bases: QgsPanelWidget

__init__(parent: QWidget | None = None, rasterLayer: QgsRasterLayer | None = None, bandNumber: int = 0)

Creates a new QgsRasterAttributeTableWidget

Parameters:
  • parent (Optional[QWidget] = None) – parent widget

  • rasterLayer (Optional[QgsRasterLayer] = None) – raster layer

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

isDirty(self) bool[source]

Returns True if the associated raster attribute table is dirty

Return type:

bool

signal rendererChanged[source]

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.

saveChanges(self)[source]

Save the changes in the raster attribute table.

setEditable(self, editable: bool, allowCancel: bool = True) bool[source]

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

Parameters:
  • editable (bool) – editable state

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

Return type:

bool

setMessageBar(self, bar: QgsMessageBar | None)[source]

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

Parameters:

bar (Optional[QgsMessageBar])

setRasterLayer(self, rasterLayer: QgsRasterLayer | None, bandNumber: int = 0)[source]

Sets the raster layer and an optional band number.

Parameters:
  • rasterLayer (Optional[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)