/
qgsattributetypedialog.h
227 lines (177 loc) · 5.86 KB
/
qgsattributetypedialog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/***************************************************************************
qgsattributetypedialog.h - description
-------------------
begin : June 2009
copyright : (C) 2009 by Richard Kostecky
email : csf.kostej@gmail.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSATTRIBUTETYPEDIALOG_H
#define QGSATTRIBUTETYPEDIALOG_H
#include "ui_qgsattributetypeedit.h"
#include "qgseditorconfigwidget.h"
#include "qgsfeature.h"
#include "qgsvectordataprovider.h"
#include "qgshelp.h"
#include "qgis_app.h"
class QWidget;
class QStandardItem;
class APP_EXPORT QgsAttributeTypeDialog: public QWidget, private Ui::QgsAttributeTypeDialog, QgsExpressionContextGenerator
{
Q_OBJECT
public:
QgsAttributeTypeDialog( QgsVectorLayer *vl, int fieldIdx, QWidget *parent = nullptr );
~QgsAttributeTypeDialog() override;
/**
* Setting page which is to be selected
* \param index index of page which was selected
*/
void setPage( int index );
const QString editorWidgetType();
const QString editorWidgetText();
void setEditorWidgetType( const QString &type );
const QVariantMap editorWidgetConfig();
void setEditorWidgetConfig( const QVariantMap &config );
/**
* Setter for checkbox to label on top
* \param bool onTop
*/
void setLabelOnTop( bool onTop );
/**
* Getter for checkbox for label on top of field
*/
bool labelOnTop() const;
/**
* Setter for label alias
*/
void setAlias( const QString &alias );
/**
* Getter for label alias
*/
QString alias() const;
/**
* Setter for label comment
*/
void setComment( const QString &comment );
/**
* Setter for checkbox for editable state of field
*/
void setFieldEditable( bool editable );
/**
* Getter for checkbox for editable state of field
*/
bool fieldEditable() const;
/**
* Sets any provider side constraints which may affect this field's behavior.
*/
void setProviderConstraints( QgsFieldConstraints::Constraints constraints );
/**
* Setter for checkbox for not null
*/
void setNotNull( bool notNull );
/**
* Getter for checkbox for not null
*/
bool notNull() const;
/**
* Returns whether the not null constraint is set by the provider
*/
bool notNullFromProvider() const;
/**
* Returns whether the unique constraint is set by the provider
*/
bool uniqueFromProvider() const;
/**
* Sets whether the not null constraint is enforced.
*/
void setNotNullEnforced( bool enforced );
/**
* Returns whether the not null constraint should be enforced.
*/
bool notNullEnforced() const;
/**
* Setter for unique constraint checkbox
*/
void setUnique( bool unique );
/**
* Getter for unique constraint checkbox state
*/
bool unique() const;
/**
* Sets whether the not null constraint is enforced.
*/
void setUniqueEnforced( bool enforced );
/**
* Returns whether the not null constraint should be enforced.
*/
bool uniqueEnforced() const;
/**
* Setter for constraint expression description
* \param desc the expression description
* \since QGIS 2.16
*/
void setConstraintExpressionDescription( const QString &desc );
/**
* Getter for constraint expression description
* \returns the expression description
* \since QGIS 2.16
*/
QString constraintExpressionDescription();
/**
* Getter for the constraint expression
* \since QGIS 2.16
*/
QString constraintExpression() const;
/**
* Setter for the constraint expression
* \since QGIS 2.16
*/
void setConstraintExpression( const QString &str );
/**
* Sets whether the expression constraint is enforced.
*/
void setConstraintExpressionEnforced( bool enforced );
/**
* Returns whether the expression constraint should be enforced.
*/
bool constraintExpressionEnforced() const;
/**
* Returns the expression used for the field's default value, or
* an empty string if no default value expression is set.
*/
QString defaultValueExpression() const;
/**
* Sets the expression used for the field's default value
*/
void setDefaultValueExpression( const QString &expression );
/**
* Returns the field id
*/
int fieldIdx() const;
QgsExpressionContext createExpressionContext() const override;
bool applyDefaultValueOnUpdate() const;
void setApplyDefaultValueOnUpdate( bool applyDefaultValueOnUpdate );
private slots:
/**
* Slot to handle change of index in combobox to select correct page
* \param index index of value in combobox
*/
void onCurrentWidgetChanged( int index );
void defaultExpressionChanged();
private:
QgsVectorLayer *mLayer = nullptr;
int mFieldIdx;
QVariantMap mWidgetConfig;
//! Cached configuration dialog (lazy loaded)
QMap< QString, QgsEditorConfigWidget * > mEditorConfigWidgets;
QStandardItem *currentItem() const;
QgsFeature mPreviewFeature;
};
#endif