QGIS API Documentation 3.41.0-Master (3291e9ff48b)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsRasterAttributeTableModel Class Reference

The QgsRasterAttributeTableModel class manages a QgsRasterAttributeTable. More...

#include <qgsrasterattributetablemodel.h>

Inheritance diagram for QgsRasterAttributeTableModel:
Inheritance graph
[legend]

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

The QgsRasterAttributeTableModel class manages 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 22 of file qgsrasterattributetablemodel.cpp.

Member Function Documentation

◆ columnCount()

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

Definition at line 330 of file qgsrasterattributetablemodel.cpp.

◆ data()

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

Definition at line 335 of file qgsrasterattributetablemodel.cpp.

◆ editable()

bool QgsRasterAttributeTableModel::editable ( ) const

Returns true if the Raster Attribute Table is editable.

Definition at line 28 of file qgsrasterattributetablemodel.cpp.

◆ flags()

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

Definition at line 507 of file qgsrasterattributetablemodel.cpp.

◆ hasColor()

bool QgsRasterAttributeTableModel::hasColor ( ) const

Returns true if the Raster Attribute Table has color information.

Definition at line 38 of file qgsrasterattributetablemodel.cpp.

◆ hasRamp()

bool QgsRasterAttributeTableModel::hasRamp ( ) const

Returns true if the Raster Attribute Table has ramp information.

Definition at line 43 of file qgsrasterattributetablemodel.cpp.

◆ headerData()

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

Definition at line 482 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 48 of file qgsrasterattributetablemodel.cpp.

◆ headerTooltip()

QString QgsRasterAttributeTableModel::headerTooltip ( const int  section) const

Returns the tooltip for the given section.

Definition at line 67 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 231 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 120 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 145 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 253 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 209 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 115 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 102 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 174 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 151 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 275 of file qgsrasterattributetablemodel.cpp.

◆ rowCount()

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

Definition at line 325 of file qgsrasterattributetablemodel.cpp.

◆ setData()

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

Definition at line 415 of file qgsrasterattributetablemodel.cpp.

◆ setEditable()

void QgsRasterAttributeTableModel::setEditable ( bool  editable)

Sets the Raster Attribute Table editable state to editable.

Definition at line 33 of file qgsrasterattributetablemodel.cpp.


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