QGIS API Documentation
2.10.1-Pisa
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
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 dot kuhn at gmx 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 = 0,
QWidget
* parent = 0 );
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(
QString
key,
QVariant
defaultVal =
QVariant
() );
91
97
const
QgsEditorWidgetConfig
config();
98
104
const
QgsAttributeEditorContext
& context();
105
113
QgsVectorLayer
* layer();
114
120
static
QgsWidgetWrapper
* fromWidget(
QWidget
* widget );
121
122
protected
:
134
virtual
QWidget
* createWidget(
QWidget
* parent ) = 0;
135
141
virtual
void
initWidget(
QWidget
* editor );
142
143
public
slots:
150
virtual
void
setFeature(
const
QgsFeature
& feature ) = 0;
151
158
virtual
void
setEnabled(
bool
enabled );
159
160
private
:
161
QgsAttributeEditorContext
mContext;
162
QgsEditorWidgetConfig
mConfig;
163
QWidget
* mWidget;
164
QWidget
* mParent;
165
QgsVectorLayer
* mLayer;
166
bool
mInitialized;
167
};
168
169
// We'll use this class inside a QVariant in the widgets properties
170
Q_DECLARE_METATYPE
(
QgsWidgetWrapper
* )
171
172
#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
QMap
QgsFeature
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition:
qgsfeature.h:162
QObject
QString
qgseditorwidgetconfig.h
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition:
qgsvectorlayer.h:620
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QgsExpression::Interval)
QgsWidgetWrapper
Manages an editor widget Widget and wrapper share the same parent.
Definition:
qgswidgetwrapper.h:39
QVariant
Generated on Sat Aug 22 2015 02:53:41 for QGIS API Documentation by
1.8.6