Class: QgsRasterAttributeTableModel¶
The QgsRasterAttributeTableModel
class manages a
QgsRasterAttributeTable
Added in version 3.30.
Class Hierarchy¶
Base classes¶
Methods
Returns true if the Raster Attribute Table is editable. |
|
Returns |
|
Returns |
|
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 in errorMessage, returns |
|
Inserts a field at the given position. |
|
Create RGBA minimum and maximum fields and inserts them at position, optionally reporting any error in errorMessage, returns |
|
Inserts a new row before position, optionally reporting any error in errorMessage, returns |
|
Returns |
|
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, returns |
|
Remove the field at given position, optionally reporting any error in errorMessage, returns |
|
Removes the row at position, optionally reporting any error in errorMessage, returns |
|
Sets the Raster Attribute Table editable state to editable. |
- class qgis.gui.QgsRasterAttributeTableModel[source]¶
Bases:
QAbstractTableModel
- __init__(rat: QgsRasterAttributeTable | None, parent: QObject | None = None)
Creates a new QgsRasterAttributeTableModel from raster attribute table
rat
and optionalparent
.- Parameters:
rat (Optional[QgsRasterAttributeTable])
parent (Optional[QObject] = None)
- editable(self) bool [source]¶
Returns true if the Raster Attribute Table is editable.
- Return type:
bool
- hasColor(self) bool [source]¶
Returns
True
if the Raster Attribute Table has color information.- Return type:
bool
- hasRamp(self) bool [source]¶
Returns
True
if the Raster Attribute Table has ramp information.- Return type:
bool
- headerNames(self) List[str] [source]¶
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 [source]¶
Returns the tooltip for the given
section
.- Parameters:
section (int)
- Return type:
str
- insertColor(self, position: int)[source]¶
Create RGBA fields and inserts them at
position
, optionally reporting any error inerrorMessage
, returnsTrue
on success.- Parameters:
position (int) -> (bool)
- insertField(self, position: int, name: str | None, usage: Qgis.RasterAttributeTableFieldUsage, type: QMetaType.Type)[source]¶
Inserts a field at the given position.
- Parameters:
name (Optional[str]) – field name
usage (Qgis.RasterAttributeTableFieldUsage) – field usage
type (QMetaType.Type) -> (bool) – field type
position (int) – insertion point (before)
- Returns:
true on success
errorMessage: error message
- insertField(self, position: int, name: str | None, usage: Qgis.RasterAttributeTableFieldUsage, type: QVariant.Type)[source]
Inserts a field at the given position.
- Parameters:
name (Optional[str]) – field name
usage (Qgis.RasterAttributeTableFieldUsage) – field usage
type (QVariant.Type) -> (bool) – field type
position (int) – insertion point (before)
- Returns:
true on success
errorMessage: error message
Deprecated since version 3.38: Use the method with a QMetaType.Type argument instead.
- insertRamp(self, position: int)[source]¶
Create RGBA minimum and maximum fields and inserts them at
position
, optionally reporting any error inerrorMessage
, returnsTrue
on success.- Parameters:
position (int) -> (bool)
- insertRow(self, position: int, rowData: Iterable[Any])[source]¶
Inserts a new row before
position
, optionally reporting any error inerrorMessage
, returnsTrue
on success.- Parameters:
position (int)
rowData (Iterable[Any]) -> (bool)
- isDirty(self) bool [source]¶
Returns
True
if the Raster Attribute Table was modified since it was last saved or read.- Return type:
bool
- isValid(self)[source]¶
Checks if the Raster Attribute Table is valid, optionally returns validation errors in
errorMessage
.
- removeColorOrRamp(self)[source]¶
Removes all color or ramp information, optionally reporting any error in
errorMessage
, returnsTrue
on success.
- removeField(self, position: int)[source]¶
Remove the field at given
position
, optionally reporting any error inerrorMessage
, returnsTrue
on success.- Parameters:
position (int) -> (bool)