QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
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 "ui_qgssymbollevelsdialogbase.h"
19
20#include "qgis_gui.h"
21#include "qgis_sip.h"
22#include "qgshelp.h"
23#include "qgspanelwidget.h"
24#include "qgsrenderer.h"
25
26#include <QDialog>
27#include <QItemDelegate>
28#include <QList>
29
36class GUI_EXPORT QgsSymbolLevelsWidget : public QgsPanelWidget, private Ui::QgsSymbolLevelsDialogBase
37{
38 Q_OBJECT
39 public:
43 QgsSymbolLevelsWidget( QgsFeatureRenderer *renderer, bool usingSymbolLevels, QWidget *parent SIP_TRANSFERTHIS = nullptr );
44
50 QgsSymbolLevelsWidget( const QgsLegendSymbolList &symbols, bool usingSymbolLevels, QWidget *parent SIP_TRANSFERTHIS = nullptr );
51
53 bool usingLevels() const;
54
61
66 void setForceOrderingEnabled( bool enabled );
67
68 public slots:
69
75 Q_DECL_DEPRECATED void apply() SIP_DEPRECATED;
76
77 private slots:
78 void updateUi();
79
80 void renderingPassChanged( int row, int column );
81
82 private:
83 void populateTable();
84 void setDefaultLevels();
85
87 int mMaxLayers = 0;
88
89 QgsFeatureRenderer *mRenderer = nullptr;
90 QgsLegendSymbolList mLegendSymbols;
91
93 bool mForceOrderingEnabled = false;
94};
95
96
103class GUI_EXPORT QgsSymbolLevelsDialog : public QDialog
104{
105 Q_OBJECT
106 public:
108 QgsSymbolLevelsDialog( QgsFeatureRenderer *renderer, bool usingSymbolLevels, QWidget *parent SIP_TRANSFERTHIS = nullptr );
109
110 // used by rule-based renderer (to hide checkbox to enable/disable ordering)
111 void setForceOrderingEnabled( bool enabled );
112
118 bool usingLevels() const;
119
126
127 private:
128 QgsSymbolLevelsWidget *mWidget = nullptr;
129
130 private slots:
131
132 void showHelp();
133};
134
135#ifndef SIP_RUN
137
138// delegate used from Qt Spin Box example
139class SpinBoxDelegate : public QItemDelegate
140{
141 Q_OBJECT
142
143 public:
144 explicit SpinBoxDelegate( QObject *parent = nullptr )
145 : QItemDelegate( parent ) {}
146
147 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem & /*option*/, const QModelIndex & /*index*/ ) const override;
148
149 void setEditorData( QWidget *editor, const QModelIndex &index ) const override;
150
151 void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
152
153 void updateEditorGeometry( QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex & /*index*/ ) const override;
154};
155
157#endif
158
159#endif // QGSSYMBOLLEVELSDIALOG_H
Abstract base class for all 2D vector feature renderers.
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
QgsLegendSymbolList symbolLevels() const
Returns the current legend symbols with rendering passes set, as defined in the widget.
QgsSymbolLevelsDialog(QgsFeatureRenderer *renderer, bool usingSymbolLevels, QWidget *parent=nullptr)
Constructor for QgsSymbolLevelsDialog.
bool usingLevels() const
Returns whether the level ordering is enabled.
void setForceOrderingEnabled(bool enabled)
A widget which allows the user to modify the rendering order of symbol layers.
QgsSymbolLevelsWidget(QgsFeatureRenderer *renderer, bool usingSymbolLevels, QWidget *parent=nullptr)
Constructor for QgsSymbolLevelsWidget.
void setForceOrderingEnabled(bool enabled)
Sets whether the level ordering is always forced on and hide the checkbox (used by rule-based rendere...
bool usingLevels() const
Returns whether the level ordering is enabled.
Q_DECL_DEPRECATED void apply()
Apply button.
QgsLegendSymbolList symbolLevels() const
Returns the current legend symbols with rendering passes set, as defined in the widget.
#define SIP_DEPRECATED
Definition qgis_sip.h:114
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
QList< QgsLegendSymbolItem > QgsLegendSymbolList