QGIS API Documentation
2.14.11-Essen
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
src
gui
qgsattributeform.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsattributeform.h
3
--------------------------------------
4
Date : 3.5.2014
5
Copyright : (C) 2014 Matthias Kuhn
6
Email : matthias at opengis dot ch
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
16
#ifndef QGSATTRIBUTEFORM_H
17
#define QGSATTRIBUTEFORM_H
18
19
#include "
qgsfeature.h
"
20
#include "
qgsvectorlayer.h
"
21
#include "
qgseditorwidgetwrapper.h
"
22
#include "
qgsattributeeditorcontext.h
"
23
24
#include <QWidget>
25
#include <QDialogButtonBox>
26
27
class
QgsAttributeFormInterface
;
28
29
class
GUI_EXPORT
QgsAttributeForm
:
public
QWidget
30
{
31
Q_OBJECT
32
33
public
:
34
explicit
QgsAttributeForm
(
QgsVectorLayer
* vl,
const
QgsFeature
&feature =
QgsFeature
(),
const
QgsAttributeEditorContext
& context =
QgsAttributeEditorContext
(),
QWidget
*parent =
nullptr
);
35
~
QgsAttributeForm
();
36
37
const
QgsFeature
&
feature
() {
return
mFeature; }
38
42
void
hideButtonBox();
43
47
void
showButtonBox();
48
53
void
disconnectButtonBox();
54
59
void
addInterface(
QgsAttributeFormInterface
* iface );
60
66
QgsVectorLayer
*
layer
() {
return
mLayer; }
67
73
bool
editable();
74
82
void
setIsAddDialog(
bool
isAddDialog );
83
89
void
setEditCommandMessage
(
const
QString
& message ) { mEditCommandMessage = message; }
90
99
bool
eventFilter
(
QObject
*
object
,
QEvent
* event )
override
;
100
101
signals:
108
void
attributeChanged(
const
QString
& attribute,
const
QVariant
& value );
109
118
void
beforeSave(
bool
& ok );
119
123
void
featureSaved(
const
QgsFeature
& feature );
124
125
public
slots:
132
void
changeAttribute(
const
QString
& field,
const
QVariant
& value );
133
139
void
setFeature(
const
QgsFeature
& feature );
140
146
bool
save();
147
153
Q_DECL_DEPRECATED
void
accept
() { save(); }
154
160
Q_DECL_DEPRECATED
void
reject
() { resetValues(); }
161
165
void
resetValues();
166
170
void
refreshFeature();
171
172
private
slots:
173
void
onAttributeChanged(
const
QVariant
& value );
174
void
onAttributeAdded(
int
idx );
175
void
onAttributeDeleted(
int
idx );
176
void
onUpdatedFields();
177
178
void
preventFeatureRefresh();
179
void
synchronizeEnabledState();
180
181
private
:
182
void
init();
183
184
void
cleanPython();
185
186
void
initPython();
187
188
QWidget
* createWidgetFromDef(
const
QgsAttributeEditorElement
* widgetDef,
QWidget
* parent,
QgsVectorLayer
* vl,
QgsAttributeEditorContext
& context,
QString
& labelText,
bool
& labelOnTop );
189
190
void
addWidgetWrapper(
QgsEditorWidgetWrapper
* eww );
191
196
void
createWrappers();
197
void
connectWrappers();
198
199
QgsVectorLayer
* mLayer;
200
QgsFeature
mFeature;
201
QList<QgsWidgetWrapper*>
mWidgets;
202
QgsAttributeEditorContext
mContext;
203
QDialogButtonBox
* mButtonBox;
204
QList<QgsAttributeFormInterface*>
mInterfaces;
205
206
// Variables below are used for python
207
static
int
sFormCounter;
208
int
mFormNr;
209
QString
mPyFormVarName;
210
212
bool
mIsSaving;
213
bool
mIsAddDialog;
214
216
bool
mPreventFeatureRefresh;
217
218
QString
mEditCommandMessage;
219
};
220
221
#endif // QGSATTRIBUTEFORM_H
qgsattributeeditorcontext.h
QEvent
QWidget
qgsfeature.h
QgsAttributeEditorElement
This is an abstract base class for any elements of a drag and drop form.
Definition:
qgseditformconfig.h:35
QgsAttributeFormInterface
Definition:
qgsattributeforminterface.h:22
QgsAttributeForm::accept
Q_DECL_DEPRECATED void accept()
Alias for save()
Definition:
qgsattributeform.h:153
QgsAttributeEditorContext
This class contains context information for attribute editor widgets.
Definition:
qgsattributeeditorcontext.h:33
QgsEditorWidgetWrapper
Manages an editor widget Widget and wrapper share the same parent.
Definition:
qgseditorwidgetwrapper.h:41
QgsFeature
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition:
qgsfeature.h:187
QgsAttributeForm::layer
QgsVectorLayer * layer()
Returns the layer for which this form is shown.
Definition:
qgsattributeform.h:66
QObject
QObject::eventFilter
virtual bool eventFilter(QObject *watched, QEvent *event)
QString
QList< QgsWidgetWrapper * >
QgsAttributeForm::reject
Q_DECL_DEPRECATED void reject()
Alias for resetValues()
Definition:
qgsattributeform.h:160
QgsAttributeForm::setEditCommandMessage
void setEditCommandMessage(const QString &message)
Sets the edit command message (Undo) that will be used when the dialog is accepted.
Definition:
qgsattributeform.h:89
QgsAttributeForm
Definition:
qgsattributeform.h:29
QDialogButtonBox
qgsvectorlayer.h
QgsAttributeForm::feature
const QgsFeature & feature()
Definition:
qgsattributeform.h:37
qgseditorwidgetwrapper.h
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition:
qgsvectorlayer.h:386
QVariant
Generated on Wed Jan 25 2017 08:47:23 for QGIS API Documentation by
1.8.8