Class: QgsRasterAttributeTableModel

class qgis.gui.QgsRasterAttributeTableModel

Bases: PyQt5.QtCore.QAbstractTableModel

The QgsRasterAttributeTableModel class manages a QgsRasterAttributeTable

New in version 3.30.

QgsRasterAttributeTableModel(rat: QgsRasterAttributeTable, parent: QObject = None) Creates a new QgsRasterAttributeTableModel from raster attribute table rat and optional parent.

Methods

beginInsertColumns

beginInsertRows

beginMoveColumns

beginMoveRows

beginRemoveColumns

beginRemoveRows

beginResetModel

changePersistentIndex

changePersistentIndexList

childEvent

columnCount

param parent

connectNotify

createIndex

customEvent

data

param index

decodeData

disconnectNotify

editable

Returns true if the Raster Attribute Table is editable.

encodeData

endInsertColumns

endInsertRows

endMoveColumns

endMoveRows

endRemoveColumns

endRemoveRows

endResetModel

flags

param index

hasColor

Returns True if the Raster Attribute Table has color information.

hasRamp

Returns True if the Raster Attribute Table has ramp information.

headerData

param section

headerNames

Returns all the header names, including the "virtual" color header if the Raster Attribute Table has color or ramp.

headerTooltip

Returns the tooltip for the given section.

insertColor

Create RGBA fields and inserts them at position, optionally reporting any error in errorMessage, returns True on success.

insertField

Inserts a field at the given position.

insertRamp

Create RGBA minimum and maximum fields and inserts them at position, optionally reporting any error in errorMessage, returns True on success.

insertRow

Inserts a new row before position, optionally reporting any error in errorMessage, returns True on success.

isDirty

Returns True if the Raster Attribute Table was modified since it was last saved or read.

isSignalConnected

isValid

Checks if the Raster Attribute Table is valid, optionally returns validation errors in errorMessage.

persistentIndexList

receivers

removeColorOrRamp

Removes all color or ramp information, optionally reporting any error in errorMessage, returns True on success.

removeField

Remove the field at given position, optionally reporting any error in errorMessage, returns True on success.

removeRow

Removes the row at position, optionally reporting any error in errorMessage, returns True on success.

resetInternalData

rowCount

param parent

sender

senderSignalIndex

setData

param index

setEditable

Sets the Raster Attribute Table editable state to editable.

timerEvent

QgsRasterAttributeTableModel.beginInsertColumns(self, QModelIndex, int, int)
QgsRasterAttributeTableModel.beginInsertRows(self, QModelIndex, int, int)
QgsRasterAttributeTableModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsRasterAttributeTableModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsRasterAttributeTableModel.beginRemoveColumns(self, QModelIndex, int, int)
QgsRasterAttributeTableModel.beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
QgsRasterAttributeTableModel.changePersistentIndex(self, QModelIndex, QModelIndex)
changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])
childEvent(self, QChildEvent)
columnCount(self, parent: QModelIndex) int
Parameters

parent (QModelIndex) –

Return type

int

connectNotify(self, QMetaMethod)
QgsRasterAttributeTableModel.createIndex(self, int, int, object: object = 0) -> QModelIndex
customEvent(self, QEvent)
data(self, index: QModelIndex, role: int) Any
Parameters
  • index (QModelIndex) –

  • role (int) –

Return type

Any

QgsRasterAttributeTableModel.decodeData(self, int, int, QModelIndex, QDataStream) -> bool
disconnectNotify(self, QMetaMethod)
editable(self) bool

Returns true if the Raster Attribute Table is editable.

Return type

bool

encodeData(self, Iterable[QModelIndex], QDataStream)
endInsertColumns(self)
endInsertRows(self)
endMoveColumns(self)
endMoveRows(self)
endRemoveColumns(self)
endRemoveRows(self)
endResetModel(self)
flags(self, index: QModelIndex) Qt.ItemFlags
Parameters

index (QModelIndex) –

Return type

Qt.ItemFlags

hasColor(self) bool

Returns True if the Raster Attribute Table has color information.

Return type

bool

hasRamp(self) bool

Returns True if the Raster Attribute Table has ramp information.

Return type

bool

headerData(self, section: int, orientation: Qt.Orientation, role: int) Any
Parameters
  • section (int) –

  • orientation (Qt.Orientation) –

  • role (int) –

Return type

Any

headerNames(self) List[str]

Returns all the header names, including the “virtual” color header if the Raster Attribute Table has color or ramp.

Return type

List[str]

headerTooltip(self, section: int) str

Returns the tooltip for the given section.

Parameters

section (int) –

Return type

str

insertColor(self, position: int) Tuple[bool, str]

Create RGBA fields and inserts them at position, optionally reporting any error in errorMessage, returns True on success.

Parameters

position (int) –

Return type

Tuple[bool, str]

insertField(self, position: int, name: str, usage: Qgis.RasterAttributeTableFieldUsage, type: QVariant.Type) Tuple[bool, str]

Inserts a field at the given position.

Parameters
Return type

Tuple[bool, str]

Returns

  • true on success

  • errorMessage: error message

insertRamp(self, position: int) Tuple[bool, str]

Create RGBA minimum and maximum fields and inserts them at position, optionally reporting any error in errorMessage, returns True on success.

Parameters

position (int) –

Return type

Tuple[bool, str]

insertRow(self, position: int, rowData: Iterable[Any]) Tuple[bool, str]

Inserts a new row before position, optionally reporting any error in errorMessage, returns True on success.

Parameters
  • position (int) –

  • rowData (Iterable[Any]) –

Return type

Tuple[bool, str]

isDirty(self) bool

Returns True if the Raster Attribute Table was modified since it was last saved or read.

Return type

bool

isSignalConnected(self, QMetaMethod) bool
isValid(self) Tuple[bool, str]

Checks if the Raster Attribute Table is valid, optionally returns validation errors in errorMessage.

Return type

Tuple[bool, str]

persistentIndexList(self) List[QModelIndex]
receivers(self, PYQT_SIGNAL) int
removeColorOrRamp(self) Tuple[bool, str]

Removes all color or ramp information, optionally reporting any error in errorMessage, returns True on success.

Return type

Tuple[bool, str]

removeField(self, position: int) Tuple[bool, str]

Remove the field at given position, optionally reporting any error in errorMessage, returns True on success.

Parameters

position (int) –

Return type

Tuple[bool, str]

removeRow(self, position: int) Tuple[bool, str]

Removes the row at position, optionally reporting any error in errorMessage, returns True on success.

Parameters

position (int) –

Return type

Tuple[bool, str]

resetInternalData(self)
rowCount(self, parent: QModelIndex) int
Parameters

parent (QModelIndex) –

Return type

int

sender(self) QObject
senderSignalIndex(self) int
setData(self, index: QModelIndex, value: Any, role: int) bool
Parameters
  • index (QModelIndex) –

  • value (Any) –

  • role (int) –

Return type

bool

setEditable(self, editable: bool)

Sets the Raster Attribute Table editable state to editable.

Parameters

editable (bool) –

timerEvent(self, QTimerEvent)