QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsstyleitemslistwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsstyleitemslistwidget.h
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 #ifndef QGSSTYLEITEMSLISTWIDGET_H
17 #define QGSSTYLEITEMSLISTWIDGET_H
18 
19 #include "ui_qgsstyleitemslistwidgetbase.h"
20 
21 #include "qgsstylemodel.h"
22 #include <QWidget>
23 #include "qgis_gui.h"
24 
25 class QgsStyle;
26 class QMenu;
27 
28 
29 #ifndef SIP_RUN
30 class QgsReadOnlyStyleModel : public QgsStyleProxyModel
32 {
33  Q_OBJECT
34  public:
35 
36  explicit QgsReadOnlyStyleModel( QgsStyleModel *sourceModel, QObject *parent = nullptr );
37  explicit QgsReadOnlyStyleModel( QgsStyle *style, QObject *parent = nullptr );
38  Qt::ItemFlags flags( const QModelIndex &index ) const override;
39  QVariant data( const QModelIndex &index, int role ) const override;
40 
41 };
42 #endif
43 
51 class GUI_EXPORT QgsStyleItemsListWidget : public QWidget, private Ui::QgsStyleItemsListWidgetBase
52 {
53  Q_OBJECT
54 
55  public:
56 
60  QgsStyleItemsListWidget( QWidget *parent SIP_TRANSFERTHIS );
61 
68  void setStyle( QgsStyle *style );
69 
75  void setEntityType( QgsStyle::StyleEntity type );
76 
82  void setEntityTypes( const QList<QgsStyle::StyleEntity> &filters ) SIP_SKIP;
83 
89  void setSymbolType( QgsSymbol::SymbolType type );
90 
97  void setLayerType( QgsWkbTypes::GeometryType type );
98 
102  QString currentTagFilter() const;
103 
104 #ifndef SIP_RUN
105 
111  QMenu *advancedMenu();
112 
122  void setAdvancedMenu( QMenu *menu );
123 
131  void showAdvancedButton( bool enabled );
132 #endif
133 
138  QString currentItemName() const;
139 
144  QgsStyle::StyleEntity currentEntityType() const;
145 
146  protected:
147 
148  void showEvent( QShowEvent *event ) override;
149 
150  signals:
151 
157  void selectionChanged( const QString &name, QgsStyle::StyleEntity type );
158 
166  void saveEntity();
167 
168  private slots:
169  void groupsCombo_currentIndexChanged( int index );
170  void updateModelFilters();
171  void onSelectionChanged( const QModelIndex &index );
172  void populateGroups();
173  void openStyleManager();
174 
175  private:
176  QgsStyle *mStyle = nullptr;
177  QgsStyleProxyModel *mModel = nullptr;
178  bool mUpdatingGroups = false;
179 };
180 
181 #endif //QGSSTYLEITEMSLISTWIDGET_H
182 
183 
184 
QgsStyleModel
Definition: qgsstylemodel.h:45
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
qgsstylemodel.h
QgsStyleItemsListWidget
Definition: qgsstyleitemslistwidget.h:51
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
QgsSymbol::SymbolType
SymbolType
Type of the symbol.
Definition: qgssymbol.h:85
QgsStyleProxyModel
Definition: qgsstylemodel.h:137
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsStyle::StyleEntity
StyleEntity
Enum for Entities involved in a style.
Definition: qgsstyle.h:178