mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
Use QgsScreenProperties in style model to ensure we correctly generate preview icons matching the device pixel ratio and DPI of all attached displays
396 lines
11 KiB
Plaintext
396 lines
11 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/symbology/qgsstylemodel.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
class QgsStyleModel: QAbstractItemModel
|
|
{
|
|
%Docstring(signature="appended")
|
|
|
|
A QAbstractItemModel subclass for showing symbol and color ramp entities contained
|
|
within a :py:class:`QgsStyle` database.
|
|
|
|
If you are creating a style model for the default application style (see :py:func:`QgsStyle.defaultStyle()`),
|
|
consider using the shared style model available at :py:func:`QgsApplication.defaultStyleModel()` for performance
|
|
instead.
|
|
|
|
.. seealso:: :py:class:`QgsStyleProxyModel`
|
|
|
|
.. versionadded:: 3.4
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsstylemodel.h"
|
|
%End
|
|
public:
|
|
|
|
enum Column
|
|
{
|
|
Name,
|
|
Tags,
|
|
};
|
|
|
|
enum Role
|
|
{
|
|
TypeRole,
|
|
TagRole,
|
|
EntityName,
|
|
SymbolTypeRole,
|
|
IsFavoriteRole,
|
|
LayerTypeRole,
|
|
CompatibleGeometryTypesRole,
|
|
StyleName,
|
|
StyleFileName,
|
|
IsTitleRole,
|
|
};
|
|
|
|
explicit QgsStyleModel( QgsStyle *style, QObject *parent /TransferThis/ = 0 );
|
|
%Docstring
|
|
Constructor for QgsStyleModel, for the specified ``style`` and ``parent`` object.
|
|
|
|
The ``style`` object must exist for the lifetime of this model.
|
|
%End
|
|
|
|
QgsStyle *style();
|
|
%Docstring
|
|
Returns the style managed by the model.
|
|
|
|
.. versionadded:: 3.10
|
|
%End
|
|
|
|
virtual QVariant data( const QModelIndex &index, int role ) const;
|
|
|
|
virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
|
|
|
|
virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
|
|
|
|
virtual QVariant headerData( int section, Qt::Orientation orientation,
|
|
int role = Qt::DisplayRole ) const;
|
|
virtual QModelIndex index( int row, int column,
|
|
const QModelIndex &parent = QModelIndex() ) const;
|
|
virtual QModelIndex parent( const QModelIndex &index ) const;
|
|
|
|
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
|
|
|
|
virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
|
|
|
|
|
|
void addDesiredIconSize( QSize size );
|
|
%Docstring
|
|
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.
|
|
%End
|
|
|
|
void addTargetScreenProperties( const QgsScreenProperties &properties );
|
|
%Docstring
|
|
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.
|
|
|
|
.. versionadded:: 3.32
|
|
%End
|
|
|
|
|
|
};
|
|
|
|
class QgsStyleProxyModel: QSortFilterProxyModel
|
|
{
|
|
%Docstring(signature="appended")
|
|
|
|
A QSortFilterProxyModel subclass for showing filtered symbol and color ramps entries from a :py:class:`QgsStyle` database.
|
|
|
|
.. seealso:: :py:class:`QgsStyleModel`
|
|
|
|
.. versionadded:: 3.4
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsstylemodel.h"
|
|
%End
|
|
public:
|
|
|
|
explicit QgsStyleProxyModel( QgsStyle *style, QObject *parent /TransferThis/ = 0 );
|
|
%Docstring
|
|
Constructor for QgsStyleProxyModel, for the specified ``style`` and ``parent`` object.
|
|
|
|
The ``style`` object must exist for the lifetime of this model.
|
|
%End
|
|
|
|
explicit QgsStyleProxyModel( QgsStyleModel *model, QObject *parent /TransferThis/ = 0 );
|
|
%Docstring
|
|
Constructor for QgsStyleProxyModel, using the specified source ``model`` and ``parent`` object.
|
|
|
|
The source ``model`` object must exist for the lifetime of this model.
|
|
%End
|
|
|
|
explicit QgsStyleProxyModel( QgsCombinedStyleModel *model, QObject *parent /TransferThis/ = 0 );
|
|
%Docstring
|
|
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.
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
QString filterString() const;
|
|
%Docstring
|
|
Returns the current filter string, if set.
|
|
|
|
.. seealso:: :py:func:`setFilterString`
|
|
%End
|
|
|
|
QgsStyle::StyleEntity entityFilter() const;
|
|
%Docstring
|
|
Returns the style entity type filter.
|
|
|
|
.. note::
|
|
|
|
This filter is only active if :py:func:`~QgsStyleProxyModel.entityFilterEnabled` is ``True``.
|
|
|
|
.. seealso:: :py:func:`setEntityFilter`
|
|
%End
|
|
|
|
void setEntityFilter( QgsStyle::StyleEntity filter );
|
|
%Docstring
|
|
Sets the style entity type ``filter``.
|
|
|
|
.. note::
|
|
|
|
This filter is only active if :py:func:`~QgsStyleProxyModel.entityFilterEnabled` is ``True``.
|
|
|
|
.. seealso:: :py:func:`entityFilter`
|
|
%End
|
|
|
|
|
|
bool entityFilterEnabled() const;
|
|
%Docstring
|
|
Returns ``True`` if filtering by entity type is enabled.
|
|
|
|
.. seealso:: :py:func:`setEntityFilterEnabled`
|
|
|
|
.. seealso:: :py:func:`entityFilter`
|
|
%End
|
|
|
|
void setEntityFilterEnabled( bool enabled );
|
|
%Docstring
|
|
Sets whether filtering by entity type is ``enabled``.
|
|
|
|
If ``enabled`` is ``False``, then the value of :py:func:`~QgsStyleProxyModel.entityFilter` will have no
|
|
effect on the model filtering.
|
|
|
|
.. seealso:: :py:func:`entityFilterEnabled`
|
|
|
|
.. seealso:: :py:func:`setEntityFilter`
|
|
%End
|
|
|
|
Qgis::SymbolType symbolType() const;
|
|
%Docstring
|
|
Returns the symbol type filter.
|
|
|
|
.. note::
|
|
|
|
This filter is only active if :py:class:`Qgis`.SymbolTypeFilterEnabled() is ``True``, and has
|
|
no effect on non-symbol entities (i.e. color ramps).
|
|
|
|
.. seealso:: :py:func:`setSymbolType`
|
|
%End
|
|
|
|
void setSymbolType( Qgis::SymbolType type );
|
|
%Docstring
|
|
Sets the symbol ``type`` filter.
|
|
|
|
.. note::
|
|
|
|
This filter is only active if :py:class:`Qgis`.SymbolTypeFilterEnabled() is ``True``.
|
|
|
|
.. seealso:: Qgis.SymbolType
|
|
%End
|
|
|
|
bool symbolTypeFilterEnabled() const;
|
|
%Docstring
|
|
Returns ``True`` if filtering by symbol type is enabled.
|
|
|
|
.. seealso:: :py:func:`setSymbolTypeFilterEnabled`
|
|
|
|
.. seealso:: Qgis.SymbolType
|
|
%End
|
|
|
|
void setSymbolTypeFilterEnabled( bool enabled );
|
|
%Docstring
|
|
Sets whether filtering by symbol type is ``enabled``.
|
|
|
|
If ``enabled`` is ``False``, then the value of :py:class:`Qgis`.SymbolType() will have no
|
|
effect on the model filtering. This has
|
|
no effect on non-symbol entities (i.e. color ramps).
|
|
|
|
.. seealso:: Qgis.SymbolTypeFilterEnabled
|
|
|
|
.. seealso:: :py:func:`setSymbolType`
|
|
%End
|
|
|
|
Qgis::GeometryType layerType() const;
|
|
%Docstring
|
|
Returns the layer type filter, or :py:class:`Qgis`.GeometryType.Unknown if no
|
|
layer type filter is present.
|
|
|
|
This setting has an effect on label settings entities and 3d symbols only.
|
|
|
|
.. seealso:: :py:func:`setLayerType`
|
|
%End
|
|
|
|
void setLayerType( Qgis::GeometryType type );
|
|
%Docstring
|
|
Sets the layer ``type`` filter. Set ``type`` to :py:class:`Qgis`.GeometryType.Unknown if no
|
|
layer type filter is desired.
|
|
|
|
.. seealso:: :py:func:`layerType`
|
|
%End
|
|
|
|
void setTagId( int id );
|
|
%Docstring
|
|
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 :py:class:`QgsCombinedStyleModel` source models. Use :py:func:`~QgsStyleProxyModel.setTagString` instead.
|
|
|
|
.. seealso:: :py:func:`tagId`
|
|
%End
|
|
|
|
int tagId() const;
|
|
%Docstring
|
|
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 :py:class:`QgsCombinedStyleModel` source models. Use :py:func:`~QgsStyleProxyModel.tagString` instead.
|
|
|
|
.. seealso:: :py:func:`setTagId`
|
|
%End
|
|
|
|
void setTagString( const QString &tag );
|
|
%Docstring
|
|
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.
|
|
|
|
.. seealso:: :py:func:`tagString`
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
QString tagString() const;
|
|
%Docstring
|
|
Returns the tag string used to filter style entities by.
|
|
|
|
If returned value is empty, then no tag filtering is being conducted.
|
|
|
|
.. seealso:: :py:func:`setTagString`
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
void setSmartGroupId( int id );
|
|
%Docstring
|
|
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 :py:class:`QgsCombinedStyleModel` source models.
|
|
|
|
.. seealso:: :py:func:`smartGroupId`
|
|
%End
|
|
|
|
int smartGroupId() const;
|
|
%Docstring
|
|
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 :py:class:`QgsCombinedStyleModel` source models.
|
|
|
|
.. seealso:: :py:func:`setSmartGroupId`
|
|
%End
|
|
|
|
virtual bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const;
|
|
|
|
virtual bool lessThan( const QModelIndex &left, const QModelIndex &right ) const;
|
|
|
|
|
|
bool favoritesOnly() const;
|
|
%Docstring
|
|
Returns ``True`` if the model is showing only favorited entities.
|
|
|
|
.. seealso:: :py:func:`setFavoritesOnly`
|
|
%End
|
|
|
|
void setFavoritesOnly( bool favoritesOnly );
|
|
%Docstring
|
|
Sets whether the model should show only favorited entities.
|
|
|
|
.. seealso:: :py:func:`setFavoritesOnly`
|
|
%End
|
|
|
|
void addDesiredIconSize( QSize size );
|
|
%Docstring
|
|
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.
|
|
%End
|
|
|
|
void addTargetScreenProperties( const QgsScreenProperties &properties );
|
|
%Docstring
|
|
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.
|
|
|
|
.. versionadded:: 3.32
|
|
%End
|
|
|
|
public slots:
|
|
|
|
void setFilterString( const QString &filter );
|
|
%Docstring
|
|
Sets a ``filter`` string, such that only symbol entities with names matching the
|
|
specified string will be shown.
|
|
|
|
.. seealso:: :py:func:`filterString`
|
|
%End
|
|
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/symbology/qgsstylemodel.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|