QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
a
b
c
d
e
f
g
i
l
m
n
o
p
s
t
+
Functions
a
b
c
d
f
g
i
l
m
n
o
p
t
Variables
Typedefs
Enumerations
Enumerator
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
2
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
2
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
+
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
+
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Properties
a
b
c
d
e
f
h
i
l
m
n
o
p
r
s
t
u
v
+
Related Functions
a
c
d
e
f
g
l
n
o
p
q
r
s
t
v
+
Files
File List
+
File Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
+
Variables
a
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
u
z
+
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
Enumerations
Enumerator
+
Macros
a
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
src
gui
editorwidgets
core
qgswidgetwrapper.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgswidgetwrapper.h
3
--------------------------------------
4
Date : 14.5.2014
5
Copyright : (C) 2013 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 QGSWIDGETWRAPPER_H
17
#define QGSWIDGETWRAPPER_H
18
19
#include <QObject>
20
#include <QMap>
21
#include <QVariant>
22
23
class
QgsVectorLayer
;
24
25
#include "
qgseditorwidgetconfig.h
"
26
#include "
qgsattributeeditorcontext.h
"
27
39
class
GUI_EXPORT
QgsWidgetWrapper
:
public
QObject
40
{
41
Q_OBJECT
42
public
:
50
explicit
QgsWidgetWrapper
(
QgsVectorLayer
* vl,
QWidget
* editor =
nullptr
,
QWidget
* parent =
nullptr
);
51
57
QWidget
* widget();
58
65
template
<
class
T>
66
T*
widget
() {
return
dynamic_cast<
T
>
( mWidget ); }
67
73
void
setConfig(
const
QgsEditorWidgetConfig
& config );
74
80
void
setContext(
const
QgsAttributeEditorContext
& context );
81
90
QVariant
config(
const
QString
& key,
const
QVariant
& defaultVal =
QVariant
() )
const
;
91
97
QgsEditorWidgetConfig
config()
const
;
98
104
const
QgsAttributeEditorContext
& context()
const
;
105
113
QgsVectorLayer
* layer()
const
;
114
120
static
QgsWidgetWrapper
* fromWidget(
QWidget
* widget );
121
133
virtual
bool
valid()
const
= 0;
134
135
protected
:
147
virtual
QWidget
* createWidget(
QWidget
* parent ) = 0;
148
154
virtual
void
initWidget(
QWidget
* editor );
155
156
public
slots:
163
virtual
void
setFeature(
const
QgsFeature
& feature ) = 0;
164
171
virtual
void
setEnabled(
bool
enabled );
172
173
private
:
174
QgsAttributeEditorContext
mContext;
175
QgsEditorWidgetConfig
mConfig;
176
QWidget
* mWidget;
177
QWidget
* mParent;
178
QgsVectorLayer
* mLayer;
179
bool
mInitialized;
180
};
181
182
// We'll use this class inside a QVariant in the widgets properties
183
Q_DECLARE_METATYPE
(
QgsWidgetWrapper
* )
184
185
#endif // QGSWIDGETWRAPPER_H
qgsattributeeditorcontext.h
QWidget
QgsWidgetWrapper::widget
T * widget()
Access the widget managed by this wrapper and cast it to a given type Example: QPushButton* pb = wrap...
Definition:
qgswidgetwrapper.h:66
QgsAttributeEditorContext
This class contains context information for attribute editor widgets.
Definition:
qgsattributeeditorcontext.h:33
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QgsMimeDataUtils::UriList)
QgsFeature
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition:
qgsfeature.h:187
QgsEditorWidgetConfig
QVariantMap QgsEditorWidgetConfig
Holds a set of configuration parameters for a editor widget wrapper.
Definition:
qgseditorwidgetconfig.h:35
QObject
QString
qgseditorwidgetconfig.h
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition:
qgsvectorlayer.h:408
QgsWidgetWrapper
Manages an editor widget Widget and wrapper share the same parent.
Definition:
qgswidgetwrapper.h:39
QVariant
Generated on Sun Jun 24 2018 11:42:48 for QGIS API Documentation by
1.8.13