QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | List of all members
QgsStyleProxyModel Class Reference

A QSortFilterProxyModel subclass for showing filtered symbol and color ramps entries from a QgsStyle database. More...

#include <qgsstylemodel.h>

Inheritance diagram for QgsStyleProxyModel:
Inheritance graph
[legend]

Public Slots

void setFilterString (const QString &filter)
 Sets a filter string, such that only symbol entities with names matching the specified string will be shown.
 

Public Member Functions

 QgsStyleProxyModel (QgsCombinedStyleModel *model, QObject *parent=nullptr)
 Constructor for QgsStyleProxyModel, using the specified source combined model and parent object.
 
 QgsStyleProxyModel (QgsStyle *style, QObject *parent=nullptr)
 Constructor for QgsStyleProxyModel, for the specified style and parent object.
 
 QgsStyleProxyModel (QgsStyleModel *model, QObject *parent=nullptr)
 Constructor for QgsStyleProxyModel, using the specified source model and parent object.
 
void addDesiredIconSize (QSize size)
 Adds an additional icon size to generate for Qt::DecorationRole data.
 
void addTargetScreenProperties (const QgsScreenProperties &properties)
 Adds additional target screen properties to use when generating icons for Qt::DecorationRole data.
 
QgsStyle::StyleEntity entityFilter () const
 Returns the style entity type filter.
 
bool entityFilterEnabled () const
 Returns true if filtering by entity type is enabled.
 
bool favoritesOnly () const
 Returns true if the model is showing only favorited entities.
 
bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override
 
QString filterString () const
 Returns the current filter string, if set.
 
Qgis::GeometryType layerType () const
 Returns the layer type filter, or Qgis::GeometryType::Unknown if no layer type filter is present.
 
bool lessThan (const QModelIndex &left, const QModelIndex &right) const override
 
void setEntityFilter (QgsStyle::StyleEntity filter)
 Sets the style entity type filter.
 
void setEntityFilterEnabled (bool enabled)
 Sets whether filtering by entity type is enabled.
 
void setEntityFilters (const QList< QgsStyle::StyleEntity > &filters)
 Sets the style entity type filters.
 
void setFavoritesOnly (bool favoritesOnly)
 Sets whether the model should show only favorited entities.
 
void setLayerType (Qgis::GeometryType type)
 Sets the layer type filter.
 
void setSmartGroupId (int id)
 Sets a smart group id to filter style entities by.
 
void setSymbolType (Qgis::SymbolType type)
 Sets the symbol type filter.
 
void setSymbolTypeFilterEnabled (bool enabled)
 Sets whether filtering by symbol type is enabled.
 
void setTagId (int id)
 Sets a tag id to filter style entities by.
 
void setTagString (const QString &tag)
 Sets a tag to filter style entities by.
 
int smartGroupId () const
 Returns the smart group id used to filter style entities by.
 
Qgis::SymbolType symbolType () const
 Returns the symbol type filter.
 
bool symbolTypeFilterEnabled () const
 Returns true if filtering by symbol type is enabled.
 
int tagId () const
 Returns the tag id used to filter style entities by.
 
QString tagString () const
 Returns the tag string used to filter style entities by.
 

Detailed Description

A QSortFilterProxyModel subclass for showing filtered symbol and color ramps entries from a QgsStyle database.

See also
QgsStyleModel
Since
QGIS 3.4

Definition at line 268 of file qgsstylemodel.h.

Constructor & Destructor Documentation

◆ QgsStyleProxyModel() [1/3]

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

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

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

Definition at line 835 of file qgsstylemodel.cpp.

◆ QgsStyleProxyModel() [2/3]

QgsStyleProxyModel::QgsStyleProxyModel ( QgsStyleModel model,
QObject *  parent = nullptr 
)
explicit

Constructor for QgsStyleProxyModel, using the specified source model and parent object.

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

Definition at line 880 of file qgsstylemodel.cpp.

◆ QgsStyleProxyModel() [3/3]

QgsStyleProxyModel::QgsStyleProxyModel ( QgsCombinedStyleModel model,
QObject *  parent = nullptr 
)
explicit

Constructor for QgsStyleProxyModel, using the specified source combined model and parent object.

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

Note
This is only available on builds based on Qt 5.13 or later.
Since
QGIS 3.26

Definition at line 889 of file qgsstylemodel.cpp.

Member Function Documentation

◆ addDesiredIconSize()

void QgsStyleProxyModel::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 1020 of file qgsstylemodel.cpp.

◆ addTargetScreenProperties()

void QgsStyleProxyModel::addTargetScreenProperties ( const QgsScreenProperties properties)

Adds additional target screen properties to use when generating icons for Qt::DecorationRole data.

This allows style icons to be generated at an icon device pixel ratio and DPI which corresponds exactly to the view's screen properties in which this model is used.

Since
QGIS 3.32

Definition at line 1028 of file qgsstylemodel.cpp.

◆ entityFilter()

QgsStyle::StyleEntity QgsStyleProxyModel::entityFilter ( ) const

Returns the style entity type filter.

Note
This filter is only active if entityFilterEnabled() is true.
See also
setEntityFilter()

Definition at line 1135 of file qgsstylemodel.cpp.

◆ entityFilterEnabled()

bool QgsStyleProxyModel::entityFilterEnabled ( ) const

Returns true if filtering by entity type is enabled.

See also
setEntityFilterEnabled()
entityFilter()

Definition at line 1124 of file qgsstylemodel.cpp.

◆ favoritesOnly()

bool QgsStyleProxyModel::favoritesOnly ( ) const

Returns true if the model is showing only favorited entities.

See also
setFavoritesOnly()

Definition at line 1009 of file qgsstylemodel.cpp.

◆ filterAcceptsRow()

bool QgsStyleProxyModel::filterAcceptsRow ( int  source_row,
const QModelIndex &  source_parent 
) const
override

Definition at line 897 of file qgsstylemodel.cpp.

◆ filterString()

QString QgsStyleProxyModel::filterString ( ) const
inline

Returns the current filter string, if set.

See also
setFilterString()

Definition at line 304 of file qgsstylemodel.h.

◆ layerType()

Qgis::GeometryType QgsStyleProxyModel::layerType ( ) const

Returns the layer type filter, or Qgis::GeometryType::Unknown if no layer type filter is present.

This setting has an effect on label settings entities and 3d symbols only.

See also
setLayerType()

Definition at line 1047 of file qgsstylemodel.cpp.

◆ lessThan()

bool QgsStyleProxyModel::lessThan ( const QModelIndex &  left,
const QModelIndex &  right 
) const
override

Definition at line 990 of file qgsstylemodel.cpp.

◆ setEntityFilter()

void QgsStyleProxyModel::setEntityFilter ( QgsStyle::StyleEntity  filter)

Sets the style entity type filter.

Note
This filter is only active if entityFilterEnabled() is true.
See also
entityFilter()

Definition at line 1140 of file qgsstylemodel.cpp.

◆ setEntityFilterEnabled()

void QgsStyleProxyModel::setEntityFilterEnabled ( bool  enabled)

Sets whether filtering by entity type is enabled.

If enabled is false, then the value of entityFilter() will have no effect on the model filtering.

See also
entityFilterEnabled()
setEntityFilter()

Definition at line 1129 of file qgsstylemodel.cpp.

◆ setEntityFilters()

void QgsStyleProxyModel::setEntityFilters ( const QList< QgsStyle::StyleEntity > &  filters)

Sets the style entity type filters.

Note
These filters are only active if entityFilterEnabled() is true.
Not available in Python bindings
See also
setEntityFilter()
Since
QGIS 3.10

Definition at line 1146 of file qgsstylemodel.cpp.

◆ setFavoritesOnly()

void QgsStyleProxyModel::setFavoritesOnly ( bool  favoritesOnly)

Sets whether the model should show only favorited entities.

See also
setFavoritesOnly()

Definition at line 1014 of file qgsstylemodel.cpp.

◆ setFilterString

void QgsStyleProxyModel::setFilterString ( const QString &  filter)
slot

Sets a filter string, such that only symbol entities with names matching the specified string will be shown.

See also
filterString()

Definition at line 1002 of file qgsstylemodel.cpp.

◆ setLayerType()

void QgsStyleProxyModel::setLayerType ( Qgis::GeometryType  type)

Sets the layer type filter.

Set type to Qgis::GeometryType::Unknown if no layer type filter is desired.

See also
layerType()

Definition at line 1052 of file qgsstylemodel.cpp.

◆ setSmartGroupId()

void QgsStyleProxyModel::setSmartGroupId ( int  id)

Sets a smart group id to filter style entities by.

Only entities within the given smart group will be shown in the model.

Set id to -1 to disable smart group filtering.

Note
This method has no effect for models created using QgsCombinedStyleModel source models.
See also
smartGroupId()

Definition at line 1091 of file qgsstylemodel.cpp.

◆ setSymbolType()

void QgsStyleProxyModel::setSymbolType ( Qgis::SymbolType  type)

Sets the symbol type filter.

Note
This filter is only active if Qgis::SymbolTypeFilterEnabled() is true.
See also
Qgis::SymbolType()

Definition at line 1118 of file qgsstylemodel.cpp.

◆ setSymbolTypeFilterEnabled()

void QgsStyleProxyModel::setSymbolTypeFilterEnabled ( bool  enabled)

Sets whether filtering by symbol type is enabled.

If enabled is false, then the value of Qgis::SymbolType() will have no effect on the model filtering. This has no effect on non-symbol entities (i.e. color ramps).

See also
Qgis::SymbolTypeFilterEnabled()
setSymbolType()

Definition at line 1041 of file qgsstylemodel.cpp.

◆ setTagId()

void QgsStyleProxyModel::setTagId ( int  id)

Sets a tag id to filter style entities by.

Only entities with the given tag will be shown in the model.

Set id to -1 to disable tag filtering.

Note
This method has no effect for models created using QgsCombinedStyleModel source models. Use setTagString() instead.
See also
tagId()

Definition at line 1058 of file qgsstylemodel.cpp.

◆ setTagString()

void QgsStyleProxyModel::setTagString ( const QString &  tag)

Sets a tag to filter style entities by.

Only entities with the given tag will be shown in the model.

Set tag to an empty string to disable tag filtering.

See also
tagString()
Since
QGIS 3.26

Definition at line 1079 of file qgsstylemodel.cpp.

◆ smartGroupId()

int QgsStyleProxyModel::smartGroupId ( ) const

Returns the smart group id used to filter style entities by.

If returned value is -1, then no smart group filtering is being conducted.

Note
This method has no effect for models created using QgsCombinedStyleModel source models.
See also
setSmartGroupId()

Definition at line 1108 of file qgsstylemodel.cpp.

◆ symbolType()

Qgis::SymbolType QgsStyleProxyModel::symbolType ( ) const

Returns the symbol type filter.

Note
This filter is only active if Qgis::SymbolTypeFilterEnabled() is true, and has no effect on non-symbol entities (i.e. color ramps).
See also
setSymbolType()

Definition at line 1113 of file qgsstylemodel.cpp.

◆ symbolTypeFilterEnabled()

bool QgsStyleProxyModel::symbolTypeFilterEnabled ( ) const

Returns true if filtering by symbol type is enabled.

See also
setSymbolTypeFilterEnabled()
Qgis::SymbolType()

Definition at line 1036 of file qgsstylemodel.cpp.

◆ tagId()

int QgsStyleProxyModel::tagId ( ) const

Returns the tag id used to filter style entities by.

If returned value is -1, then no tag filtering is being conducted.

Note
This method has no effect for models created using QgsCombinedStyleModel source models. Use tagString() instead.
See also
setTagId()

Definition at line 1074 of file qgsstylemodel.cpp.

◆ tagString()

QString QgsStyleProxyModel::tagString ( ) const

Returns the tag string used to filter style entities by.

If returned value is empty, then no tag filtering is being conducted.

See also
setTagString()
Since
QGIS 3.26

Definition at line 1086 of file qgsstylemodel.cpp.


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