QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
QgsRasterAttributeTableModel Class Reference

A model which represents a QgsRasterAttributeTable. More...

#include <qgsrasterattributetablemodel.h>

Inheritance diagram for QgsRasterAttributeTableModel:

Public Member Functions

 QgsRasterAttributeTableModel (QgsRasterAttributeTable *rat, QObject *parent=nullptr)
 Creates a new QgsRasterAttributeTableModel from raster attribute table rat and optional parent.
int columnCount (const QModelIndex &parent) const override
QVariant data (const QModelIndex &index, int role) const override
bool editable () const
 Returns true if the Raster Attribute Table is editable.
Qt::ItemFlags flags (const QModelIndex &index) const override
bool hasColor () const
 Returns true if the Raster Attribute Table has color information.
bool hasRamp () const
 Returns true if the Raster Attribute Table has ramp information.
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
QStringList headerNames () const
 Returns all the header names, including the "virtual" color header if the Raster Attribute Table has color or ramp.
QString headerTooltip (const int section) const
 Returns the tooltip for the given section.
bool insertColor (int position, QString *errorMessage=nullptr)
 Create RGBA fields and inserts them at position, optionally reporting any error in errorMessage, returns true on success.
bool insertField (const int position, const QString &name, const Qgis::RasterAttributeTableFieldUsage usage, const QMetaType::Type type, QString *errorMessage=nullptr)
 Inserts a field at the given position.
Q_DECL_DEPRECATED bool insertField (const int position, const QString &name, const Qgis::RasterAttributeTableFieldUsage usage, const QVariant::Type type, QString *errorMessage=nullptr)
 Inserts a field at the given position.
bool insertRamp (int position, QString *errorMessage=nullptr)
 Create RGBA minimum and maximum fields and inserts them at position, optionally reporting any error in errorMessage, returns true on success.
bool insertRow (const int position, const QVariantList &rowData, QString *errorMessage=nullptr)
 Inserts a new row before position, optionally reporting any error in errorMessage, returns true on success.
bool isDirty ()
 Returns true if the Raster Attribute Table was modified since it was last saved or read.
bool isValid (QString *errorMessage=nullptr)
 Checks if the Raster Attribute Table is valid, optionally returns validation errors in errorMessage.
bool removeColorOrRamp (QString *errorMessage=nullptr)
 Removes all color or ramp information, optionally reporting any error in errorMessage, returns true on success.
bool removeField (const int position, QString *errorMessage=nullptr)
 Remove the field at given position, optionally reporting any error in errorMessage, returns true on success.
bool removeRow (const int position, QString *errorMessage=nullptr)
 Removes the row at position, optionally reporting any error in errorMessage, returns true on success.
int rowCount (const QModelIndex &parent) const override
bool setData (const QModelIndex &index, const QVariant &value, int role) override
void setEditable (bool editable)
 Sets the Raster Attribute Table editable state to editable.

Detailed Description

A model which represents a QgsRasterAttributeTable.

Since
QGIS 3.30

Definition at line 31 of file qgsrasterattributetablemodel.h.

Constructor & Destructor Documentation

◆ QgsRasterAttributeTableModel()

QgsRasterAttributeTableModel::QgsRasterAttributeTableModel ( QgsRasterAttributeTable * rat,
QObject * parent = nullptr )
explicit

Creates a new QgsRasterAttributeTableModel from raster attribute table rat and optional parent.

Definition at line 23 of file qgsrasterattributetablemodel.cpp.

Member Function Documentation

◆ columnCount()

int QgsRasterAttributeTableModel::columnCount ( const QModelIndex & parent) const
override

Definition at line 321 of file qgsrasterattributetablemodel.cpp.

◆ data()

QVariant QgsRasterAttributeTableModel::data ( const QModelIndex & index,
int role ) const
override

Definition at line 326 of file qgsrasterattributetablemodel.cpp.

◆ editable()

bool QgsRasterAttributeTableModel::editable ( ) const

Returns true if the Raster Attribute Table is editable.

Definition at line 29 of file qgsrasterattributetablemodel.cpp.

◆ flags()

Qt::ItemFlags QgsRasterAttributeTableModel::flags ( const QModelIndex & index) const
override

Definition at line 498 of file qgsrasterattributetablemodel.cpp.

◆ hasColor()

bool QgsRasterAttributeTableModel::hasColor ( ) const

Returns true if the Raster Attribute Table has color information.

Definition at line 39 of file qgsrasterattributetablemodel.cpp.

◆ hasRamp()

bool QgsRasterAttributeTableModel::hasRamp ( ) const

Returns true if the Raster Attribute Table has ramp information.

Definition at line 44 of file qgsrasterattributetablemodel.cpp.

◆ headerData()

QVariant QgsRasterAttributeTableModel::headerData ( int section,
Qt::Orientation orientation,
int role ) const
override

Definition at line 473 of file qgsrasterattributetablemodel.cpp.

◆ headerNames()

QStringList QgsRasterAttributeTableModel::headerNames ( ) const

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

Definition at line 49 of file qgsrasterattributetablemodel.cpp.

◆ headerTooltip()

QString QgsRasterAttributeTableModel::headerTooltip ( const int section) const

Returns the tooltip for the given section.

Definition at line 68 of file qgsrasterattributetablemodel.cpp.

◆ insertColor()

bool QgsRasterAttributeTableModel::insertColor ( int position,
QString * errorMessage = nullptr )

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

Definition at line 222 of file qgsrasterattributetablemodel.cpp.

◆ insertField() [1/2]

bool QgsRasterAttributeTableModel::insertField ( const int position,
const QString & name,
const Qgis::RasterAttributeTableFieldUsage usage,
const QMetaType::Type type,
QString * errorMessage = nullptr )

Inserts a field at the given position.

Parameters
namefield name
usagefield usage
typefield type
positioninsertion point (before)
errorMessageoptional error message
Returns
true on success

Definition at line 114 of file qgsrasterattributetablemodel.cpp.

◆ insertField() [2/2]

bool QgsRasterAttributeTableModel::insertField ( const int position,
const QString & name,
const Qgis::RasterAttributeTableFieldUsage usage,
const QVariant::Type type,
QString * errorMessage = nullptr )

Inserts a field at the given position.

Parameters
namefield name
usagefield usage
typefield type
positioninsertion point (before)
errorMessageoptional error message
Returns
true on success
Deprecated
QGIS 3.38. Use the method with a QMetaType::Type argument instead.

Definition at line 138 of file qgsrasterattributetablemodel.cpp.

◆ insertRamp()

bool QgsRasterAttributeTableModel::insertRamp ( int position,
QString * errorMessage = nullptr )

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

Definition at line 244 of file qgsrasterattributetablemodel.cpp.

◆ insertRow()

bool QgsRasterAttributeTableModel::insertRow ( const int position,
const QVariantList & rowData,
QString * errorMessage = nullptr )

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

Definition at line 200 of file qgsrasterattributetablemodel.cpp.

◆ isDirty()

bool QgsRasterAttributeTableModel::isDirty ( )

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

Definition at line 109 of file qgsrasterattributetablemodel.cpp.

◆ isValid()

bool QgsRasterAttributeTableModel::isValid ( QString * errorMessage = nullptr)

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

Definition at line 96 of file qgsrasterattributetablemodel.cpp.

◆ removeColorOrRamp()

bool QgsRasterAttributeTableModel::removeColorOrRamp ( QString * errorMessage = nullptr)

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

Definition at line 166 of file qgsrasterattributetablemodel.cpp.

◆ removeField()

bool QgsRasterAttributeTableModel::removeField ( const int position,
QString * errorMessage = nullptr )

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

Definition at line 144 of file qgsrasterattributetablemodel.cpp.

◆ removeRow()

bool QgsRasterAttributeTableModel::removeRow ( const int position,
QString * errorMessage = nullptr )

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

Definition at line 266 of file qgsrasterattributetablemodel.cpp.

◆ rowCount()

int QgsRasterAttributeTableModel::rowCount ( const QModelIndex & parent) const
override

Definition at line 316 of file qgsrasterattributetablemodel.cpp.

◆ setData()

bool QgsRasterAttributeTableModel::setData ( const QModelIndex & index,
const QVariant & value,
int role )
override

Definition at line 406 of file qgsrasterattributetablemodel.cpp.

◆ setEditable()

void QgsRasterAttributeTableModel::setEditable ( bool editable)

Sets the Raster Attribute Table editable state to editable.

Definition at line 34 of file qgsrasterattributetablemodel.cpp.


The documentation for this class was generated from the following files: