Class: QgsRasterAttributeTableModel¶
- class qgis.gui.QgsRasterAttributeTableModel¶
Bases:
PyQt5.QtCore.QAbstractTableModel
The
QgsRasterAttributeTableModel
class manages aQgsRasterAttributeTable
New in version 3.30.
QgsRasterAttributeTableModel(rat:
QgsRasterAttributeTable
, parent: QObject = None) Creates a newQgsRasterAttributeTableModel
from raster attribute tablerat
and optionalparent
.Methods
beginInsertColumns
beginInsertRows
beginMoveColumns
beginMoveRows
beginRemoveColumns
beginRemoveRows
changePersistentIndex
- param parent:
createIndex
- param index:
decodeData
Returns true if the Raster Attribute Table is editable.
- param index:
Returns
True
if the Raster Attribute Table has color information.Returns
True
if the Raster Attribute Table has ramp information.- param section:
Returns all the header names, including the "virtual" color header if the Raster Attribute Table has color or ramp.
Returns the tooltip for the given
section
.Create RGBA fields and inserts them at
position
, optionally reporting any error inerrorMessage
, returnsTrue
on success.Inserts a field at the given position.
Create RGBA minimum and maximum fields and inserts them at
position
, optionally reporting any error inerrorMessage
, returnsTrue
on success.Inserts a new row before
position
, optionally reporting any error inerrorMessage
, returnsTrue
on success.Returns
True
if the Raster Attribute Table was modified since it was last saved or read.Checks if the Raster Attribute Table is valid, optionally returns validation errors in
errorMessage
.Removes all color or ramp information, optionally reporting any error in
errorMessage
, returnsTrue
on success.Remove the field at given
position
, optionally reporting any error inerrorMessage
, returnsTrue
on success.Removes the row at
position
, optionally reporting any error inerrorMessage
, returnsTrue
on success.- param parent:
- param index:
Sets the Raster Attribute Table editable state to
editable
.- 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 inerrorMessage
, returnsTrue
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:
name (str) – field name
usage (Qgis.RasterAttributeTableFieldUsage) – field usage
type (QVariant.Type) – field type
position (int) – insertion point (before)
- 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 inerrorMessage
, returnsTrue
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 inerrorMessage
, returnsTrue
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
, returnsTrue
on success.- Return type:
Tuple[bool, str]
- removeField(self, position: int) Tuple[bool, str] ¶
Remove the field at given
position
, optionally reporting any error inerrorMessage
, returnsTrue
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 inerrorMessage
, returnsTrue
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)¶