QGIS API Documentation  3.6.0-Noosa (5873452)
Public Types | Public Member Functions | List of all members
QgsStyleModel Class Reference

A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle database. More...

#include <qgsstylemodel.h>

Inheritance diagram for QgsStyleModel:
Inheritance graph
[legend]

Public Types

enum  Column { Name = 0, Tags }
 Model columns. More...
 
enum  Role { TypeRole = Qt::UserRole + 1, TagRole, SymbolTypeRole }
 Custom model roles. More...
 

Public Member Functions

 QgsStyleModel (QgsStyle *style, QObject *parent=nullptr)
 Constructor for QgsStyleModel, for the specified style and parent object. More...
 
void addDesiredIconSize (QSize size)
 Adds an additional icon size to generate for Qt::DecorationRole data. More...
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role) const override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 
QModelIndex parent (const QModelIndex &index) const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 

Detailed Description

A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle database.

See also
QgsStyleProxyModel
Since
QGIS 3.4

Definition at line 41 of file qgsstylemodel.h.

Member Enumeration Documentation

◆ Column

Model columns.

Enumerator
Name 

Name column.

Tags 

Tags column.

Definition at line 48 of file qgsstylemodel.h.

◆ Role

Custom model roles.

Enumerator
TypeRole 

Style entity type, see QgsStyle::StyleEntity.

TagRole 

String list of tags.

SymbolTypeRole 

Symbol type (for symbol entities)

Definition at line 55 of file qgsstylemodel.h.

Constructor & Destructor Documentation

◆ QgsStyleModel()

QgsStyleModel::QgsStyleModel ( QgsStyle style,
QObject *  parent = nullptr 
)
explicit

Constructor for QgsStyleModel, for the specified style and parent object.

The style object must exist for the lifetime of this model.

Definition at line 27 of file qgsstylemodel.cpp.

Member Function Documentation

◆ addDesiredIconSize()

void QgsStyleModel::addDesiredIconSize ( QSize  size)

Adds an additional icon size to generate for Qt::DecorationRole data.

This allows style icons to be generated at an icon size which corresponds exactly to the view's icon size in which this model is used.

Definition at line 294 of file qgsstylemodel.cpp.

◆ columnCount()

int QgsStyleModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 289 of file qgsstylemodel.cpp.

◆ data()

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

Definition at line 59 of file qgsstylemodel.cpp.

◆ flags()

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

Definition at line 219 of file qgsstylemodel.cpp.

◆ headerData()

QVariant QgsStyleModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

Definition at line 232 of file qgsstylemodel.cpp.

◆ index()

QModelIndex QgsStyleModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
override

Definition at line 261 of file qgsstylemodel.cpp.

◆ parent()

QModelIndex QgsStyleModel::parent ( const QModelIndex &  index) const
override

Definition at line 274 of file qgsstylemodel.cpp.

◆ rowCount()

int QgsStyleModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 280 of file qgsstylemodel.cpp.

◆ setData()

bool QgsStyleModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override

Definition at line 192 of file qgsstylemodel.cpp.


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