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
qgseditorwidgetwrapper.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgseditorwidgetwrapper.cpp
3
--------------------------------------
4
Date : 20.4.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 "
qgseditorwidgetwrapper.h
"
17
#include "
qgsvectorlayer.h
"
18
#include "
qgsfield.h
"
19
20
#include <QWidget>
21
22
QgsEditorWidgetWrapper::QgsEditorWidgetWrapper
(
QgsVectorLayer
* vl,
int
fieldIdx, QWidget* editor, QWidget* parent )
23
:
QgsWidgetWrapper
( vl, editor, parent )
24
, mFieldIdx( fieldIdx )
25
{
26
}
27
28
int
QgsEditorWidgetWrapper::fieldIdx
()
29
{
30
return
mFieldIdx;
31
}
32
33
QgsField
QgsEditorWidgetWrapper::field
()
34
{
35
return
layer
()->
pendingFields
()[mFieldIdx];
36
}
37
38
QgsEditorWidgetWrapper
*
QgsEditorWidgetWrapper::fromWidget
( QWidget* widget )
39
{
40
return
qobject_cast<
QgsEditorWidgetWrapper
*>( widget->property(
"EWV2Wrapper"
).value<
QgsWidgetWrapper
*>() );
41
}
42
43
void
QgsEditorWidgetWrapper::setEnabled
(
bool
enabled )
44
{
45
QWidget* wdg =
widget
();
46
if
( wdg )
47
{
48
wdg->setEnabled( enabled );
49
}
50
}
51
52
void
QgsEditorWidgetWrapper::setFeature
(
const
QgsFeature
& feature )
53
{
54
setValue
( feature.
attribute
( mFieldIdx ) );
55
}
56
57
void
QgsEditorWidgetWrapper::valueChanged
(
const
QString& value )
58
{
59
emit
valueChanged
( QVariant( value ) );
60
}
61
62
void
QgsEditorWidgetWrapper::valueChanged
(
int
value )
63
{
64
emit
valueChanged
( QVariant( value ) );
65
}
66
67
void
QgsEditorWidgetWrapper::valueChanged
(
double
value )
68
{
69
emit
valueChanged
( QVariant( value ) );
70
}
71
72
void
QgsEditorWidgetWrapper::valueChanged
(
bool
value )
73
{
74
emit
valueChanged
( QVariant( value ) );
75
}
76
77
void
QgsEditorWidgetWrapper::valueChanged
( qlonglong value )
78
{
79
emit
valueChanged
( QVariant( value ) );
80
}
81
82
void
QgsEditorWidgetWrapper::valueChanged
()
83
{
84
emit
valueChanged
(
value
() );
85
}
Generated on Sun May 10 2015 16:33:25 for QGIS API Documentation by
1.8.1.2