23 : QConcatenateTablesProxyModel( parent )
30 return QgsStyleModel::headerDataStatic( section, orientation, role );
35 connect( style, &QgsStyle::destroyed,
this, [
this, style]()
39 removeSourceModel( model );
40 mTitleModels.remove( style );
44 if (
QgsStyleModel *model = mOwnedStyleModels.value( style ) )
46 removeSourceModel( model );
47 mOwnedStyleModels.remove( style );
50 mStyles.removeAll( style );
53 mStyles.append( style );
58 { Qt::DisplayRole, style->
name() },
59 { Qt::ToolTipRole, style->
name() },
69 addSourceModel( titleModel );
70 mTitleModels.insert( style, titleModel );
74 for ( QSize size : std::as_const( mAdditionalSizes ) )
79 for (
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
84 addSourceModel( styleModel );
85 mOwnedStyleModels.insert( style, styleModel );
92 removeSourceModel( model );
93 mTitleModels.remove( style );
97 if (
QgsStyleModel *model = mOwnedStyleModels.value( style ) )
99 removeSourceModel( model );
100 mOwnedStyleModels.remove( style );
103 mStyles.removeAll( style );
110 if ( !defaultStyle || !styleModel )
113 mStyles.append( defaultStyle );
118 { Qt::DisplayRole, defaultStyle->
name() },
119 { Qt::ToolTipRole, defaultStyle->
name() },
130 addSourceModel( titleModel );
131 mTitleModels.insert( defaultStyle, titleModel );
133 for ( QSize size : std::as_const( mAdditionalSizes ) )
138 for (
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
143 addSourceModel( styleModel );
153 if ( !mAdditionalSizes.contains( size ) )
154 mAdditionalSizes.append( size );
156 for (
auto it = mOwnedStyleModels.constBegin(); it != mOwnedStyleModels.constEnd(); ++it )
158 it.value()->addDesiredIconSize( size );
169 if ( !mTargetScreenProperties.contains( properties ) )
170 mTargetScreenProperties.insert( properties );
172 for (
auto it = mOwnedStyleModels.constBegin(); it != mOwnedStyleModels.constEnd(); ++it )
174 it.value()->addTargetScreenProperties( properties );
static QgsStyleModel * defaultStyleModel()
Returns a shared QgsStyleModel containing the default style library (see QgsStyle::defaultStyle()).
void addTargetScreenProperties(const QgsScreenProperties &properties)
Adds additional target screen properties to use when generating icons for Qt::DecorationRole data.
QList< QgsStyle * > styles() const
Returns a list of all styles shown in the model.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
QgsCombinedStyleModel(QObject *parent=nullptr)
Constructor for QgsCombinedStyleModel with the specified parent object.
void removeStyle(QgsStyle *style)
Removes a style from the model.
void addStyle(QgsStyle *style)
Adds a style to the model.
void addDefaultStyle()
Adds the default style (QgsStyle::defaultStyle()) to the model.
void addDesiredIconSize(QSize size)
Adds an additional icon size to generate for Qt::DecorationRole data.
Stores properties relating to a screen.
A QgsSingleItemModel subclass which contains a single read-only item.
A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle ...
@ IsTitle
True if the index corresponds to a title item.
@ StyleFileName
File name of associated QgsStyle (QgsStyle::fileName())
@ StyleName
Name of associated QgsStyle (QgsStyle::name())
void addTargetScreenProperties(const QgsScreenProperties &properties)
Adds additional target screen properties to use when generating icons for Qt::DecorationRole data.
void addDesiredIconSize(QSize size)
Adds an additional icon size to generate for Qt::DecorationRole data.
QString fileName() const
Returns the current file name of the style database.
static QgsStyle * defaultStyle(bool initialize=true)
Returns the default application-wide style.
QString name() const
Returns the name of the style.