QGIS API Documentation  3.14.0-Pi (9f7028fd23)
Public Slots | Public Member Functions | List of all members
QgsStyleProxyModel Class Reference

#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. More...
 

Public Member Functions

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

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 137 of file qgsstylemodel.h.

Constructor & Destructor Documentation

◆ QgsStyleProxyModel() [1/2]

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 625 of file qgsstylemodel.cpp.

◆ QgsStyleProxyModel() [2/2]

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 674 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 761 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 847 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 836 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 750 of file qgsstylemodel.cpp.

◆ filterAcceptsRow()

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

Definition at line 682 of file qgsstylemodel.cpp.

◆ filterString()

QString QgsStyleProxyModel::filterString ( ) const
inline

Returns the current filter string, if set.

See also
setFilterString()

Definition at line 162 of file qgsstylemodel.h.

◆ layerType()

QgsWkbTypes::GeometryType QgsStyleProxyModel::layerType ( ) const

Returns the layer type filter, or QgsWkbTypes::UnknownGeometry if no layer type filter is present.

This setting has no effect on non-label settings entities (i.e. color ramps).

See also
setLayerType()

Definition at line 777 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 852 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 841 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 858 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 755 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 743 of file qgsstylemodel.cpp.

◆ setLayerType()

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

Sets the layer type filter.

Set type to QgsWkbTypes::UnknownGeometry if no layer type filter is desired.

See also
layerType()

Definition at line 782 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.

See also
smartGroupId()

Definition at line 807 of file qgsstylemodel.cpp.

◆ setSymbolType()

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

Sets the symbol type filter.

Note
This filter is only active if symbolTypeFilterEnabled() is true.
See also
symbolType()

Definition at line 830 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 symbolType() will have no effect on the model filtering. This has no effect on non-symbol entities (i.e. color ramps).

See also
symbolTypeFilterEnabled()
setSymbolType()

Definition at line 771 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.

See also
tagId()

Definition at line 788 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.

See also
setSmartGroupId()

Definition at line 820 of file qgsstylemodel.cpp.

◆ symbolType()

QgsSymbol::SymbolType QgsStyleProxyModel::symbolType ( ) const

Returns the symbol type filter.

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

Definition at line 825 of file qgsstylemodel.cpp.

◆ symbolTypeFilterEnabled()

bool QgsStyleProxyModel::symbolTypeFilterEnabled ( ) const

Returns true if filtering by symbol type is enabled.

See also
setSymbolTypeFilterEnabled()
symbolType()

Definition at line 766 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.

See also
setTagId()

Definition at line 802 of file qgsstylemodel.cpp.


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