QGIS API Documentation 3.41.0-Master (af5edcb665c)
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
34class GUI_EXPORT QgsFieldConditionalFormatWidget : public QgsPanelWidget, private Ui::QgsFieldConditionalWidget
35{
36 Q_OBJECT
37 public:
41 explicit QgsFieldConditionalFormatWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
42
48 Q_DECL_DEPRECATED void viewRules() SIP_DEPRECATED;
49
53 void setLayer( QgsVectorLayer *layer );
54
55 // TODO QGIS 4.0 - make private
56
62 void editStyle( int index, const QgsConditionalStyle &style );
63
67 Q_DECL_DEPRECATED void loadStyle( const QgsConditionalStyle &style ) SIP_DEPRECATED;
68
74 Q_DECL_DEPRECATED void reset() SIP_DEPRECATED;
75
79 void setPresets( const QList<QgsConditionalStyle> &styles );
80
85 static QList<QgsConditionalStyle> defaultPresets();
86
87 signals:
88
96 void rulesUpdated( const QString &fieldName );
97
98 private:
99 QgsVectorLayer *mLayer = nullptr;
100 int mEditIndex = -1;
101 bool mEditing = false;
102 bool mPanelHandled = false;
103 QStandardItemModel *mModel = nullptr;
104
105 QList<QgsConditionalStyle> mPresets;
106
107 QList<QgsConditionalStyle> getStyles();
108
109 private slots:
110
111 void typeChanged();
112 void ruleClicked( const QModelIndex &index );
113 void reloadStyles();
114 void addNewRule();
115 void fieldChanged( const QString &fieldName );
116 void deleteCurrentRule();
117};
118
125class GUI_EXPORT QgsEditConditionalFormatRuleWidget : public QgsPanelWidget, private Ui::QgsEditConditionalRuleWidget
126{
127 Q_OBJECT
128
129 public:
133 explicit QgsEditConditionalFormatRuleWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
134
138 void setLayer( QgsVectorLayer *layer );
139
143 void setPresets( const QList<QgsConditionalStyle> &styles );
144
150 void loadStyle( const QgsConditionalStyle &style );
151
157 QgsConditionalStyle currentStyle() const;
158
162 void setRule( const QString &rule );
163
164 signals:
165
169 void ruleSaved();
170
175
179 void canceled();
180
181 private:
182 QgsVectorLayer *mLayer = nullptr;
183 QStandardItemModel *mPresetsModel = nullptr;
184 QList<QgsConditionalStyle> mPresets;
185
186 void setFormattingFromStyle( const QgsConditionalStyle &style );
187
188 private slots:
189 void setExpression();
190 void presetSet( int index );
191 bool isCustomSet();
192};
193
194#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