QGIS API Documentation  3.2.0-Bonn (bc43194)
qgssymbollevelsdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssymbollevelsdialog.h
3  ---------------------
4  begin : November 2009
5  copyright : (C) 2009 by Martin Dobias
6  email : wonder dot sk at gmail dot 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 #ifndef QGSSYMBOLLEVELSDIALOG_H
16 #define QGSSYMBOLLEVELSDIALOG_H
17 
18 #include <QDialog>
19 #include "qgis_sip.h"
20 #include <QList>
21 #include <QItemDelegate>
22 
23 #include "qgshelp.h"
24 #include "qgspanelwidget.h"
25 #include "qgsrenderer.h"
26 
27 #include "ui_qgssymbollevelsdialogbase.h"
28 #include "qgis_gui.h"
29 
37 class GUI_EXPORT QgsSymbolLevelsWidget : public QgsPanelWidget, private Ui::QgsSymbolLevelsDialogBase
38 {
39  Q_OBJECT
40  public:
42  QgsSymbolLevelsWidget( QgsFeatureRenderer *renderer, bool usingSymbolLevels, QWidget *parent SIP_TRANSFERTHIS = nullptr );
43 
45  bool usingLevels() const;
46 
51  void setForceOrderingEnabled( bool enabled );
52 
53  public slots:
55  void apply();
56 
57  private slots:
58  void updateUi();
59 
60  void renderingPassChanged( int row, int column );
61 
62  protected:
64  void populateTable() SIP_SKIP;
66  void setDefaultLevels() SIP_SKIP;
67 
70 
71  QgsFeatureRenderer *mRenderer = nullptr;
73 
76 
77  private:
78 #ifdef SIP_RUN
80 
81 #endif
82 };
83 
90 class GUI_EXPORT QgsSymbolLevelsDialog : public QDialog
91 {
92  Q_OBJECT
93  public:
94 
96  QgsSymbolLevelsDialog( QgsFeatureRenderer *renderer, bool usingSymbolLevels, QWidget *parent SIP_TRANSFERTHIS = nullptr );
97 
98  // used by rule-based renderer (to hide checkbox to enable/disable ordering)
99  void setForceOrderingEnabled( bool enabled );
100 
101  private:
102 
103  QgsSymbolLevelsWidget *mWidget = nullptr;
104 
105  private slots:
106 
107  void showHelp();
108 };
109 
110 #ifndef SIP_RUN
111 
113 // delegate used from Qt Spin Box example
114 class SpinBoxDelegate : public QItemDelegate
115 {
116  Q_OBJECT
117 
118  public:
119  explicit SpinBoxDelegate( QObject *parent = nullptr ) : QItemDelegate( parent ) {}
120 
121  QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem & /*option*/, const QModelIndex &/*index*/ ) const override;
122 
123  void setEditorData( QWidget *editor, const QModelIndex &index ) const override;
124 
125  void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
126 
127  void updateEditorGeometry( QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex & /*index*/ ) const override;
128 
129 };
130 
132 #endif
133 
134 #endif // QGSSYMBOLLEVELSDIALOG_H
QgsLegendSymbolList mList
QList< QgsLegendSymbolItem > QgsLegendSymbolList
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
int mMaxLayers
maximal number of layers from all symbols
Base class for any widget that can be shown as a inline panel.
#define SIP_SKIP
Definition: qgis_sip.h:119
A widget which allows the user to modify the rendering order of symbol layers.
A dialog which allows the user to modify the rendering order of symbol layers.
bool mForceOrderingEnabled
whether symbol layers always should be used (default false)