17#include "moc_qgscombinedstylemodel.cpp" 
   24  : QConcatenateTablesProxyModel( parent )
 
 
   31  return QgsStyleModel::headerDataStatic( section, orientation, role );
 
 
   36  connect( style, &QgsStyle::destroyed, 
this, [
this, style]()
 
   40      removeSourceModel( model );
 
   41      mTitleModels.remove( style );
 
   45    if ( 
QgsStyleModel *model = mOwnedStyleModels.value( style ) )
 
   47      removeSourceModel( model );
 
   48      mOwnedStyleModels.remove( style );
 
   51    mStyles.removeAll( style );
 
   54  mStyles.append( style );
 
   59      { Qt::DisplayRole, style->
name() },
 
   60      { Qt::ToolTipRole, style->
name() },
 
   70  addSourceModel( titleModel );
 
   71  mTitleModels.insert( style, titleModel );
 
   75  for ( QSize size : std::as_const( mAdditionalSizes ) )
 
   80  for ( 
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
 
   85  addSourceModel( styleModel );
 
   86  mOwnedStyleModels.insert( style, styleModel );
 
 
   93    removeSourceModel( model );
 
   94    mTitleModels.remove( style );
 
   98  if ( 
QgsStyleModel *model = mOwnedStyleModels.value( style ) )
 
  100    removeSourceModel( model );
 
  101    mOwnedStyleModels.remove( style );
 
  104  mStyles.removeAll( style );
 
 
  111  if ( !defaultStyle || !styleModel )
 
  114  mStyles.append( defaultStyle );
 
  119      { Qt::DisplayRole, defaultStyle->
name() },
 
  120      { Qt::ToolTipRole, defaultStyle->
name() },
 
  131  addSourceModel( titleModel );
 
  132  mTitleModels.insert( defaultStyle, titleModel );
 
  134  for ( QSize size : std::as_const( mAdditionalSizes ) )
 
  139  for ( 
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
 
  144  addSourceModel( styleModel );
 
 
  154  if ( !mAdditionalSizes.contains( size ) )
 
  155    mAdditionalSizes.append( size );
 
  157  for ( 
auto it = mOwnedStyleModels.constBegin(); it != mOwnedStyleModels.constEnd(); ++it )
 
  159    it.value()->addDesiredIconSize( size );
 
 
  170  if ( !mTargetScreenProperties.contains( properties ) )
 
  171    mTargetScreenProperties.insert( properties );
 
  173  for ( 
auto it = mOwnedStyleModels.constBegin(); it != mOwnedStyleModels.constEnd(); ++it )
 
  175    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 QAbstractItemModel 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.
 
A database of saved style entities, including symbols, color ramps, text formats and others.
 
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.