QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsfieldconditionalformatwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsfieldconditionalformatwidget.h
3 ---------------------
4 begin : August 2015
5 copyright : (C) 2015 by Nathan Woodrow
6 email : woodrow dot nathan 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 QGSFIELDCONDITIONALFORMATWIDGET_H
16#define QGSFIELDCONDITIONALFORMATWIDGET_H
17
18#include <QWidget>
19#include <QStandardItemModel>
20#include <QStandardItem>
21#include "qgspanelwidget.h"
22#include "qgspanelwidgetstack.h"
23
24#include "ui_qgsfieldconditionalformatwidget.h"
25#include "ui_qgseditconditionalformatrulewidget.h"
26#include "qgsconditionalstyle.h"
27#include "qgis_gui.h"
28
35class GUI_EXPORT QgsFieldConditionalFormatWidget : public QgsPanelWidget, private Ui::QgsFieldConditionalWidget
36{
37 Q_OBJECT
38 public:
39
43 explicit QgsFieldConditionalFormatWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
44
50 Q_DECL_DEPRECATED void viewRules() SIP_DEPRECATED;
51
55 void setLayer( QgsVectorLayer *layer );
56
57 // TODO QGIS 4.0 - make private
58
64 void editStyle( int index, const QgsConditionalStyle &style );
65
69 Q_DECL_DEPRECATED void loadStyle( const QgsConditionalStyle &style ) SIP_DEPRECATED;
70
76 Q_DECL_DEPRECATED void reset() SIP_DEPRECATED;
77
81 void setPresets( const QList<QgsConditionalStyle> &styles );
82
87 static QList<QgsConditionalStyle> defaultPresets();
88
89 signals:
90
98 void rulesUpdated( const QString &fieldName );
99
100 private:
101 QgsVectorLayer *mLayer = nullptr;
102 int mEditIndex = -1;
103 bool mEditing = false;
104 bool mPanelHandled = false;
105 QStandardItemModel *mModel = nullptr;
106
107 QList<QgsConditionalStyle> mPresets;
108
109 QList<QgsConditionalStyle> getStyles();
110
111 private slots:
112
113 void typeChanged();
114 void ruleClicked( const QModelIndex &index );
115 void reloadStyles();
116 void addNewRule();
117 void fieldChanged( const QString &fieldName );
118 void deleteCurrentRule();
119
120};
121
128class GUI_EXPORT QgsEditConditionalFormatRuleWidget : public QgsPanelWidget, private Ui::QgsEditConditionalRuleWidget
129{
130 Q_OBJECT
131
132 public:
133
137 explicit QgsEditConditionalFormatRuleWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
138
142 void setLayer( QgsVectorLayer *layer );
143
147 void setPresets( const QList<QgsConditionalStyle> &styles );
148
154 void loadStyle( const QgsConditionalStyle &style );
155
161 QgsConditionalStyle currentStyle() const;
162
166 void setRule( const QString &rule );
167
168 signals:
169
173 void ruleSaved();
174
179
183 void canceled();
184
185 private:
186 QgsVectorLayer *mLayer = nullptr;
187 int mEditIndex = 0;
188 bool mEditing = false;
189 QStandardItemModel *mModel = nullptr;
190 QStandardItemModel *mPresetsModel = nullptr;
191 QList<QgsConditionalStyle> mPresets;
192
193 void setFormattingFromStyle( const QgsConditionalStyle &style );
194
195 private slots:
196 void setExpression();
197 void presetSet( int index );
198 bool isCustomSet();
199
200};
201
202#endif // QGSFIELDCONDITIONALFORMATWIDGET_H
Conditional styling for a rule.
A widget for customizing an individual conditional formatting rule.
void canceled()
Emitted when a user has opted to cancel the rule modification.
void ruleDeleted()
Emitted when a user has opted to deleted the current rule.
void ruleSaved()
Emitted when a user has opted to save the current rule.
A widget for customizing conditional formatting options.
void rulesUpdated(const QString &fieldName)
Emitted when the conditional styling rules are updated.
Base class for any widget that can be shown as a inline panel.
Represents a vector layer which manages a vector based data sets.
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53