QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsstyleitemslistwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsstyleitemslistwidget.cpp
3  ---------------------------
4  begin : June 2019
5  copyright : (C) 2019 by Nyall Dawson
6  email : nyall dot dawson at gmail.com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 
18 #include "qgsstylemanagerdialog.h"
19 #include "qgsstylesavedialog.h"
20 #include "qgspanelwidget.h"
21 #include "qgssettings.h"
22 #include "qgsgui.h"
24 #include "qgsapplication.h"
25 
26 //
27 // QgsReadOnlyStyleModel
28 //
29 
31 QgsReadOnlyStyleModel::QgsReadOnlyStyleModel( QgsStyleModel *sourceModel, QObject *parent )
32  : QgsStyleProxyModel( sourceModel, parent )
33 {
34 
35 }
36 
37 QgsReadOnlyStyleModel::QgsReadOnlyStyleModel( QgsStyle *style, QObject *parent )
38  : QgsStyleProxyModel( style, parent )
39 {
40 
41 }
42 
43 Qt::ItemFlags QgsReadOnlyStyleModel::flags( const QModelIndex &index ) const
44 {
45  return QgsStyleProxyModel::flags( index ) & ~Qt::ItemIsEditable;
46 }
47 
48 QVariant QgsReadOnlyStyleModel::data( const QModelIndex &index, int role ) const
49 {
50  if ( role == Qt::FontRole )
51  {
52  // drop font size to get reasonable amount of item name shown
53  QFont f = QgsStyleProxyModel::data( index, role ).value< QFont >();
54  f.setPointSize( 9 );
55  return f;
56  }
57  return QgsStyleProxyModel::data( index, role );
58 }
59 
61 
62 
63 //
64 // QgsStyleItemsListWidget
65 //
66 
68  : QWidget( parent )
69 {
70  setupUi( this );
71 
72  btnAdvanced->hide(); // advanced button is hidden by default
73  btnAdvanced->setMenu( new QMenu( this ) );
74 
75 
76 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
77  double iconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().width( 'X' ) * 10;
78 #else
79  double iconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 10;
80 #endif
81  viewSymbols->setIconSize( QSize( static_cast< int >( iconSize ), static_cast< int >( iconSize * 0.9 ) ) ); // ~100, 90 on low dpi
82 
83 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
84  double treeIconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().width( 'X' ) * 2;
85 #else
86  double treeIconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 2;
87 #endif
88  mSymbolTreeView->setIconSize( QSize( static_cast< int >( treeIconSize ), static_cast< int >( treeIconSize ) ) );
89  mSymbolTreeView->setMinimumHeight( mSymbolTreeView->fontMetrics().height() * 6 );
90 
91  viewSymbols->setSelectionBehavior( QAbstractItemView::SelectRows );
92  mSymbolTreeView->setSelectionMode( viewSymbols->selectionMode() );
93 
94  connect( openStyleManagerButton, &QToolButton::clicked, this, &QgsStyleItemsListWidget::openStyleManager );
95 
96  lblSymbolName->clear();
97 
98  connect( mButtonIconView, &QToolButton::toggled, this, [ = ]( bool active )
99  {
100  if ( active )
101  {
102  mSymbolViewStackedWidget->setCurrentIndex( 0 );
103  // note -- we have to save state here and not in destructor, as new symbol list widgets are created before the previous ones are destroyed
104  QgsSettings().setValue( QStringLiteral( "UI/symbolsList/lastIconView" ), 0, QgsSettings::Gui );
105  }
106  } );
107  connect( mButtonListView, &QToolButton::toggled, this, [ = ]( bool active )
108  {
109  if ( active )
110  {
111  QgsSettings().setValue( QStringLiteral( "UI/symbolsList/lastIconView" ), 1, QgsSettings::Gui );
112  mSymbolViewStackedWidget->setCurrentIndex( 1 );
113  }
114  } );
115 
116  // restore previous view
117  QgsSettings settings;
118  const int currentView = settings.value( QStringLiteral( "UI/symbolsList/lastIconView" ), 0, QgsSettings::Gui ).toInt();
119  if ( currentView == 0 )
120  mButtonIconView->setChecked( true );
121  else
122  mButtonListView->setChecked( true );
123 
124  mSymbolTreeView->header()->restoreState( settings.value( QStringLiteral( "UI/symbolsList/treeState" ), QByteArray(), QgsSettings::Gui ).toByteArray() );
125  connect( mSymbolTreeView->header(), &QHeaderView::sectionResized, this, [this]
126  {
127  // note -- we have to save state here and not in destructor, as new symbol list widgets are created before the previous ones are destroyed
128  QgsSettings().setValue( QStringLiteral( "UI/symbolsList/treeState" ), mSymbolTreeView->header()->saveState(), QgsSettings::Gui );
129  } );
130 
131  QgsFilterLineEdit *groupEdit = new QgsFilterLineEdit();
132  groupEdit->setShowSearchIcon( true );
133  groupEdit->setShowClearButton( true );
134  groupEdit->setPlaceholderText( tr( "Filter symbols…" ) );
135  groupsCombo->setLineEdit( groupEdit );
136 
137  connect( btnSaveSymbol, &QPushButton::clicked, this, &QgsStyleItemsListWidget::saveEntity );
138 }
139 
141 {
142  mStyle = style;
143 
144  mModel = mStyle == QgsStyle::defaultStyle() ? new QgsReadOnlyStyleModel( QgsApplication::defaultStyleModel(), this )
145  : new QgsReadOnlyStyleModel( mStyle, this );
146 
147  mModel->addDesiredIconSize( viewSymbols->iconSize() );
148  mModel->addDesiredIconSize( mSymbolTreeView->iconSize() );
149  viewSymbols->setModel( mModel );
150  mSymbolTreeView->setModel( mModel );
151 
152  connect( mStyle, &QgsStyle::groupsModified, this, &QgsStyleItemsListWidget::populateGroups );
153 
154  mSymbolTreeView->setSelectionModel( viewSymbols->selectionModel() );
155  connect( viewSymbols->selectionModel(), &QItemSelectionModel::currentChanged, this, &QgsStyleItemsListWidget::onSelectionChanged );
156 
157  populateGroups();
158  connect( groupsCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsStyleItemsListWidget::groupsCombo_currentIndexChanged );
159  connect( groupsCombo, &QComboBox::currentTextChanged, this, &QgsStyleItemsListWidget::updateModelFilters );
160 
161  QgsSettings settings;
162  mSymbolTreeView->header()->restoreState( settings.value( QStringLiteral( "UI/symbolsList/treeState" ), QByteArray(), QgsSettings::Gui ).toByteArray() );
163 }
164 
166 {
167  mModel->setEntityFilterEnabled( true );
168  mModel->setEntityFilter( type );
169  const int allGroup = groupsCombo->findData( QVariant( "all" ) );
170  switch ( type )
171  {
173  btnSaveSymbol->setText( tr( "Save Symbol…" ) );
174  btnSaveSymbol->setToolTip( tr( "Save symbol to styles" ) );
175  if ( allGroup >= 0 )
176  groupsCombo->setItemText( allGroup, tr( "All Symbols" ) );
177  break;
178 
180  btnSaveSymbol->setText( tr( "Save Color Ramp…" ) );
181  btnSaveSymbol->setToolTip( tr( "Save color ramp to styles" ) );
182  if ( allGroup >= 0 )
183  groupsCombo->setItemText( allGroup, tr( "All Color Ramps" ) );
184  break;
185 
187  btnSaveSymbol->setText( tr( "Save Format…" ) );
188  btnSaveSymbol->setToolTip( tr( "Save text format to styles" ) );
189  if ( allGroup >= 0 )
190  groupsCombo->setItemText( allGroup, tr( "All Text Formats" ) );
191  break;
192 
194  btnSaveSymbol->setText( tr( "Save Label Settings…" ) );
195  btnSaveSymbol->setToolTip( tr( "Save label settings to styles" ) );
196  if ( allGroup >= 0 )
197  groupsCombo->setItemText( allGroup, tr( "All Label Settings" ) );
198  break;
199 
201  btnSaveSymbol->setText( tr( "Save Legend Patch Shape…" ) );
202  btnSaveSymbol->setToolTip( tr( "Save legend patch shape to styles" ) );
203  if ( allGroup >= 0 )
204  groupsCombo->setItemText( allGroup, tr( "All Legend Patch Shapes" ) );
205  break;
206 
207  case QgsStyle::TagEntity:
209  break;
210  }
211 }
212 
213 void QgsStyleItemsListWidget::setEntityTypes( const QList<QgsStyle::StyleEntity> &filters )
214 {
215  mModel->setEntityFilterEnabled( true );
216  mModel->setEntityFilters( filters );
217 
218  // bit of a gross hack -- run now! this will need revisiting when other parent widgets use different filter combinations!
219  const int allGroup = groupsCombo->findData( QVariant( "all" ) );
220  if ( filters.length() == 2 && filters.contains( QgsStyle::LabelSettingsEntity ) && filters.contains( QgsStyle::TextFormatEntity ) )
221  {
222  btnSaveSymbol->setText( tr( "Save Settings…" ) );
223  btnSaveSymbol->setToolTip( tr( "Save label settings or text format to styles" ) );
224  if ( allGroup >= 0 )
225  groupsCombo->setItemText( allGroup, tr( "All Settings" ) );
226  }
227 }
228 
230 {
231  mModel->setSymbolTypeFilterEnabled( true );
232  mModel->setSymbolType( type );
233 }
234 
236 {
237  mModel->setLayerType( type );
238 }
239 
241 {
242  return groupsCombo->currentData().toString() == QLatin1String( "tag" ) ? groupsCombo->currentText() : QString();
243 }
244 
246 {
247  return btnAdvanced->menu();
248 }
249 
251 {
252  if ( menu ) // show it if there is a menu pointer
253  {
254  btnAdvanced->show();
255  btnAdvanced->setMenu( menu );
256  }
257 }
258 
260 {
261  btnAdvanced->setVisible( enabled );
262 }
263 
265 {
266  QItemSelection selection = viewSymbols->selectionModel()->selection();
267  if ( selection.isEmpty() )
268  return QString();
269 
270  const QModelIndex index = selection.at( 0 ).topLeft();
271 
272  return mModel->data( index, QgsStyleModel::Name ).toString();
273 }
274 
276 {
277  QItemSelection selection = viewSymbols->selectionModel()->selection();
278  if ( selection.isEmpty() )
279  return QgsStyle::SymbolEntity;
280 
281  const QModelIndex index = selection.at( 0 ).topLeft();
282 
283  return static_cast< QgsStyle::StyleEntity >( mModel->data( index, QgsStyleModel::TypeRole ).toInt() );
284 }
285 
286 void QgsStyleItemsListWidget::showEvent( QShowEvent *event )
287 {
288  // restore header sizes on show event -- because this widget is used in multiple places simultaneously
289  // (e.g. layer styling dock, it's shown in both the symbology and labeling sections), then we want
290  // to ensure that a header resize for any of the widgets applies the next time any other item list widgets
291  // are shown.
292  QWidget::showEvent( event );
293  QgsSettings settings;
294  mSymbolTreeView->header()->restoreState( settings.value( QStringLiteral( "UI/symbolsList/treeState" ), QByteArray(), QgsSettings::Gui ).toByteArray() );
295 }
296 
297 void QgsStyleItemsListWidget::populateGroups()
298 {
299  if ( !mStyle )
300  return;
301 
302  mUpdatingGroups = true;
303  groupsCombo->blockSignals( true );
304  groupsCombo->clear();
305 
306  groupsCombo->addItem( tr( "Favorites" ), QVariant( "favorite" ) );
307 
308  QString allText = tr( "All Symbols" );
309  if ( mModel->entityFilterEnabled() )
310  {
311  switch ( mModel->entityFilter() )
312  {
314  allText = tr( "All Symbols" );
315  break;
316 
318  allText = tr( "All Color Ramps" );
319  break;
320 
322  allText = tr( "All Text Formats" );
323  break;
324 
326  allText = tr( "All Label Settings" );
327  break;
328 
330  allText = tr( "All Legend Patch Shapes" );
331  break;
332 
333  case QgsStyle::TagEntity:
335  break;
336  }
337  }
338 
339  groupsCombo->addItem( allText, QVariant( "all" ) );
340 
341  int index = 2;
342  QStringList tags = mStyle->tags();
343  if ( tags.count() > 0 )
344  {
345  tags.sort();
346  groupsCombo->insertSeparator( index );
347  const auto constTags = tags;
348  for ( const QString &tag : constTags )
349  {
350  groupsCombo->addItem( tag, QVariant( "tag" ) );
351  index++;
352  }
353  }
354 
355  QStringList groups = mStyle->smartgroupNames();
356  if ( groups.count() > 0 )
357  {
358  groups.sort();
359  groupsCombo->insertSeparator( index + 1 );
360  const auto constGroups = groups;
361  for ( const QString &group : constGroups )
362  {
363  groupsCombo->addItem( group, QVariant( "smartgroup" ) );
364  }
365  }
366  groupsCombo->blockSignals( false );
367 
368  QgsSettings settings;
369  index = settings.value( QStringLiteral( "qgis/symbolsListGroupsIndex" ), 0 ).toInt();
370  groupsCombo->setCurrentIndex( index );
371 
372  mUpdatingGroups = false;
373 
374  updateModelFilters();
375 }
376 
377 void QgsStyleItemsListWidget::updateModelFilters()
378 {
379  if ( mUpdatingGroups || !mModel )
380  return;
381 
382  const QString text = groupsCombo->currentText();
383  const bool isFreeText = text != groupsCombo->itemText( groupsCombo->currentIndex() );
384 
385  if ( isFreeText )
386  {
387  mModel->setFavoritesOnly( false );
388  mModel->setTagId( -1 );
389  mModel->setSmartGroupId( -1 );
390  mModel->setFilterString( groupsCombo->currentText() );
391  }
392  else if ( groupsCombo->currentData().toString() == QLatin1String( "favorite" ) )
393  {
394  mModel->setFavoritesOnly( true );
395  mModel->setTagId( -1 );
396  mModel->setSmartGroupId( -1 );
397  mModel->setFilterString( QString() );
398  }
399  else if ( groupsCombo->currentData().toString() == QLatin1String( "all" ) )
400  {
401  mModel->setFavoritesOnly( false );
402  mModel->setTagId( -1 );
403  mModel->setSmartGroupId( -1 );
404  mModel->setFilterString( QString() );
405  }
406  else if ( groupsCombo->currentData().toString() == QLatin1String( "smartgroup" ) )
407  {
408  mModel->setFavoritesOnly( false );
409  mModel->setTagId( -1 );
410  mModel->setSmartGroupId( mStyle->smartgroupId( text ) );
411  mModel->setFilterString( QString() );
412  }
413  else
414  {
415  mModel->setFavoritesOnly( false );
416  mModel->setTagId( mStyle->tagId( text ) );
417  mModel->setSmartGroupId( -1 );
418  mModel->setFilterString( QString() );
419  }
420 }
421 
422 void QgsStyleItemsListWidget::openStyleManager()
423 {
424  // prefer to use global window manager to open the style manager, if possible!
425  // this allows reuse of an existing non-modal window instead of opening a new modal window.
426  // Note that we only use the non-modal dialog if we're open in the panel -- if we're already
427  // open as part of a modal dialog, then we MUST use another modal dialog or the result will
428  // not be focusable!
430  if ( !panel || !panel->dockMode()
432  || !QgsGui::windowManager()->openStandardDialog( QgsWindowManagerInterface::DialogStyleManager ) )
433  {
434  // fallback to modal dialog
435  QgsStyleManagerDialog dlg( mStyle, this );
436  dlg.exec();
437 
438  updateModelFilters(); // probably not needed -- the model should automatically update if any changes were made
439  }
440 }
441 
442 void QgsStyleItemsListWidget::onSelectionChanged( const QModelIndex &index )
443 {
444  if ( !mModel )
445  return;
446 
447  QString symbolName = mModel->data( mModel->index( index.row(), QgsStyleModel::Name ) ).toString();
448  lblSymbolName->setText( symbolName );
449 
450  emit selectionChanged( symbolName, static_cast< QgsStyle::StyleEntity >( mModel->data( index, QgsStyleModel::TypeRole ).toInt() ) );
451 }
452 
453 void QgsStyleItemsListWidget::groupsCombo_currentIndexChanged( int index )
454 {
455  QgsSettings settings;
456  settings.setValue( QStringLiteral( "qgis/symbolsListGroupsIndex" ), index );
457 }
QgsStyleProxyModel::setEntityFilters
void setEntityFilters(const QList< QgsStyle::StyleEntity > &filters)
Sets the style entity type filters.
Definition: qgsstylemodel.cpp:858
QgsStyleItemsListWidget::saveEntity
void saveEntity()
Emitted when the user has opted to save a new entity to the style database, by clicking the "Save" bu...
qgsstyleitemslistwidget.h
QgsStyle::ColorrampEntity
@ ColorrampEntity
Color ramps.
Definition: qgsstyle.h:182
QgsStyleModel
Definition: qgsstylemodel.h:45
QgsSettings::value
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
Definition: qgssettings.cpp:174
QgsPanelWidget::findParentPanel
static QgsPanelWidget * findParentPanel(QWidget *widget)
Traces through the parents of a widget to find if it is contained within a QgsPanelWidget widget.
Definition: qgspanelwidget.cpp:49
qgsstylemanagerdialog.h
qgsgui.h
QgsStyleItemsListWidget::setEntityType
void setEntityType(QgsStyle::StyleEntity type)
Sets the type of style entity to show in the widget.
Definition: qgsstyleitemslistwidget.cpp:165
QgsStyleItemsListWidget::currentTagFilter
QString currentTagFilter() const
Returns the current tag filter set for the widget, if any is set.
Definition: qgsstyleitemslistwidget.cpp:240
QgsFilterLineEdit
Definition: qgsfilterlineedit.h:39
QgsStyleProxyModel::setEntityFilterEnabled
void setEntityFilterEnabled(bool enabled)
Sets whether filtering by entity type is enabled.
Definition: qgsstylemodel.cpp:841
QgsStyleItemsListWidget::QgsStyleItemsListWidget
QgsStyleItemsListWidget(QWidget *parent SIP_TRANSFERTHIS)
Constructor for QgsStyleItemsListWidget, with the specified parent widget.
Definition: qgsstyleitemslistwidget.cpp:67
QgsGui::windowManager
static QgsWindowManagerInterface * windowManager()
Returns the global window manager, if set.
Definition: qgsgui.cpp:142
QgsStyleProxyModel::setFilterString
void setFilterString(const QString &filter)
Sets a filter string, such that only symbol entities with names matching the specified string will be...
Definition: qgsstylemodel.cpp:743
QgsSettings
Definition: qgssettings.h:61
QgsStyleManagerDialog
Definition: qgsstylemanagerdialog.h:67
QgsStyleItemsListWidget::advancedMenu
QMenu * advancedMenu()
Returns a pointer to the widget's current advanced menu.
Definition: qgsstyleitemslistwidget.cpp:245
QgsStyle::LegendPatchShapeEntity
@ LegendPatchShapeEntity
Legend patch shape (since QGIS 3.14)
Definition: qgsstyle.h:186
QgsPanelWidget::dockMode
bool dockMode()
Returns the dock mode state.
Definition: qgspanelwidget.h:83
qgsstylesavedialog.h
QgsStyleProxyModel::setSmartGroupId
void setSmartGroupId(int id)
Sets a smart group id to filter style entities by.
Definition: qgsstylemodel.cpp:807
QgsStyle::SymbolEntity
@ SymbolEntity
Symbols.
Definition: qgsstyle.h:180
QgsStyle::TagEntity
@ TagEntity
Tags.
Definition: qgsstyle.h:181
QgsGuiUtils::iconSize
QSize iconSize(bool dockableToolbar)
Returns the user-preferred size of a window's toolbar icons.
Definition: qgsguiutils.cpp:264
QgsStyle::LabelSettingsEntity
@ LabelSettingsEntity
Label settings.
Definition: qgsstyle.h:185
QgsStyle::defaultStyle
static QgsStyle * defaultStyle()
Returns default application-wide style.
Definition: qgsstyle.cpp:111
qgsapplication.h
QgsStyleModel::TypeRole
@ TypeRole
Style entity type, see QgsStyle::StyleEntity.
Definition: qgsstylemodel.h:61
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
QgsFilterLineEdit::setShowSearchIcon
void setShowSearchIcon(bool visible)
Define if a search icon shall be shown on the left of the image when no text is entered.
Definition: qgsfilterlineedit.cpp:49
QgsStyleItemsListWidget::setSymbolType
void setSymbolType(QgsSymbol::SymbolType type)
Sets the type of symbols to show in the widget.
Definition: qgsstyleitemslistwidget.cpp:229
QgsStyleItemsListWidget::selectionChanged
void selectionChanged(const QString &name, QgsStyle::StyleEntity type)
Emitted when the selected item is changed in the widget.
QgsApplication::defaultStyleModel
static QgsStyleModel * defaultStyleModel()
Returns a shared QgsStyleModel containing the default style library (see QgsStyle::defaultStyle()).
Definition: qgsapplication.cpp:2184
QgsStyle::smartgroupNames
QStringList smartgroupNames() const
Returns the smart groups list.
Definition: qgsstyle.cpp:2100
QgsStyle::tags
QStringList tags() const
Returns a list of all tags in the style database.
Definition: qgsstyle.cpp:1185
QgsStyleItemsListWidget::setAdvancedMenu
void setAdvancedMenu(QMenu *menu)
Sets the widget's advanced menu, which is shown when the user clicks the "Advanced" button in the wid...
Definition: qgsstyleitemslistwidget.cpp:250
QgsStyle::SmartgroupEntity
@ SmartgroupEntity
Smart groups.
Definition: qgsstyle.h:183
Qgis::UI_SCALE_FACTOR
static const double UI_SCALE_FACTOR
UI scaling factor.
Definition: qgis.h:195
QgsStyle::groupsModified
void groupsModified()
Emitted every time a tag or smartgroup has been added, removed, or renamed.
QgsSettings::setValue
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
Definition: qgssettings.cpp:289
QgsStyleItemsListWidget::showAdvancedButton
void showAdvancedButton(bool enabled)
Sets whether the advanced button should be shown in the widget.
Definition: qgsstyleitemslistwidget.cpp:259
QgsStyleProxyModel::setLayerType
void setLayerType(QgsWkbTypes::GeometryType type)
Sets the layer type filter.
Definition: qgsstylemodel.cpp:782
QgsStyleItemsListWidget::setStyle
void setStyle(QgsStyle *style)
Sets the style database associated with the widget.
Definition: qgsstyleitemslistwidget.cpp:140
QgsStyleProxyModel::setEntityFilter
void setEntityFilter(QgsStyle::StyleEntity filter)
Sets the style entity type filter.
Definition: qgsstylemodel.cpp:852
QgsStyleProxyModel::setSymbolType
void setSymbolType(QgsSymbol::SymbolType type)
Sets the symbol type filter.
Definition: qgsstylemodel.cpp:830
QgsStyle::smartgroupId
int smartgroupId(const QString &smartgroup)
Returns the database id for the given smartgroup name.
Definition: qgsstyle.cpp:1990
QgsWkbTypes::GeometryType
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:139
QgsStyle
Definition: qgsstyle.h:159
QgsStyle::TextFormatEntity
@ TextFormatEntity
Text formats.
Definition: qgsstyle.h:184
QgsStyleProxyModel::entityFilterEnabled
bool entityFilterEnabled() const
Returns true if filtering by entity type is enabled.
Definition: qgsstylemodel.cpp:836
QgsStyleItemsListWidget::setEntityTypes
void setEntityTypes(const QList< QgsStyle::StyleEntity > &filters) SIP_SKIP
Sets the types of style entity to show in the widget.
Definition: qgsstyleitemslistwidget.cpp:213
QgsStyleProxyModel::addDesiredIconSize
void addDesiredIconSize(QSize size)
Adds an additional icon size to generate for Qt::DecorationRole data.
Definition: qgsstylemodel.cpp:761
QgsStyleItemsListWidget::currentEntityType
QgsStyle::StyleEntity currentEntityType() const
Returns the type of the item currently selected in the widget.
Definition: qgsstyleitemslistwidget.cpp:275
QgsStyleProxyModel::setSymbolTypeFilterEnabled
void setSymbolTypeFilterEnabled(bool enabled)
Sets whether filtering by symbol type is enabled.
Definition: qgsstylemodel.cpp:771
qgssettings.h
QgsStyleProxyModel::setFavoritesOnly
void setFavoritesOnly(bool favoritesOnly)
Sets whether the model should show only favorited entities.
Definition: qgsstylemodel.cpp:755
QgsStyleProxyModel::setTagId
void setTagId(int id)
Sets a tag id to filter style entities by.
Definition: qgsstylemodel.cpp:788
QgsFilterLineEdit::setShowClearButton
void setShowClearButton(bool visible)
Sets whether the widget's clear button is visible.
Definition: qgsfilterlineedit.cpp:43
QgsSymbol::SymbolType
SymbolType
Type of the symbol.
Definition: qgssymbol.h:85
qgspanelwidget.h
QgsStyleProxyModel
Definition: qgsstylemodel.h:137
QgsStyleItemsListWidget::setLayerType
void setLayerType(QgsWkbTypes::GeometryType type)
Sets the layer type to show in the widget.
Definition: qgsstyleitemslistwidget.cpp:235
qgswindowmanagerinterface.h
QgsStyleItemsListWidget::currentItemName
QString currentItemName() const
Returns the name of the item currently selected in the widget.
Definition: qgsstyleitemslistwidget.cpp:264
QgsStyleProxyModel::entityFilter
QgsStyle::StyleEntity entityFilter() const
Returns the style entity type filter.
Definition: qgsstylemodel.cpp:847
QgsStyleItemsListWidget::showEvent
void showEvent(QShowEvent *event) override
Definition: qgsstyleitemslistwidget.cpp:286
QgsSettings::Gui
@ Gui
Definition: qgssettings.h:71
QgsStyle::tagId
int tagId(const QString &tag)
Returns the database id for the given tag name.
Definition: qgsstyle.cpp:1985
QgsStyleModel::Name
@ Name
Name column.
Definition: qgsstylemodel.h:54
QgsStyle::StyleEntity
StyleEntity
Enum for Entities involved in a style.
Definition: qgsstyle.h:178