QGIS API Documentation
2.8.2-Wien
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.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgswidgetwrapper.cpp
3
--------------------------------------
4
Date : 14.5.2013
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
#include "
qgswidgetwrapper.h
"
17
#include "
qgsvectorlayer.h
"
18
19
#include <QWidget>
20
21
QgsWidgetWrapper::QgsWidgetWrapper
(
QgsVectorLayer
* vl, QWidget* editor, QWidget* parent )
22
: QObject( parent )
23
, mWidget( editor )
24
, mParent( parent )
25
, mLayer( vl )
26
, mInitialized( false )
27
{
28
}
29
30
QWidget*
QgsWidgetWrapper::widget
()
31
{
32
if
( !mWidget )
33
mWidget =
createWidget
( mParent );
34
35
if
( !mInitialized )
36
{
37
mWidget->setProperty(
"EWV2Wrapper"
, QVariant::fromValue<QgsWidgetWrapper*>(
this
) );
38
initWidget
( mWidget );
39
mInitialized =
true
;
40
}
41
42
return
mWidget;
43
}
44
45
void
QgsWidgetWrapper::setConfig
(
const
QgsEditorWidgetConfig
& config )
46
{
47
mConfig =
config
;
48
}
49
50
void
QgsWidgetWrapper::setContext
(
const
QgsAttributeEditorContext
&context )
51
{
52
mContext =
context
;
53
}
54
55
QVariant
QgsWidgetWrapper::config
( QString key, QVariant defaultVal )
56
{
57
if
( mConfig.contains( key ) )
58
{
59
return
mConfig[key];
60
}
61
return
defaultVal;
62
}
63
64
const
QgsEditorWidgetConfig
QgsWidgetWrapper::config
()
65
{
66
return
mConfig;
67
}
68
69
const
QgsAttributeEditorContext
&
QgsWidgetWrapper::context
()
70
{
71
return
mContext;
72
}
73
74
QgsVectorLayer
*
QgsWidgetWrapper::layer
()
75
{
76
return
mLayer;
77
}
78
79
QgsWidgetWrapper
*
QgsWidgetWrapper::fromWidget
( QWidget* widget )
80
{
81
return
widget->property(
"EWV2Wrapper"
).value<
QgsWidgetWrapper
*>();
82
}
83
84
void
QgsWidgetWrapper::initWidget
( QWidget* editor )
85
{
86
Q_UNUSED( editor )
87
}
88
89
void
QgsWidgetWrapper::setEnabled
(
bool
enabled )
90
{
91
Q_UNUSED( enabled );
92
}
Generated on Sun May 10 2015 16:33:25 for QGIS API Documentation by
1.8.1.2