QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgseditorwidgetfactory.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgseditorwidgetfactory.cpp
3  --------------------------------------
4  Date : 21.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 "qgseditorwidgetfactory.h"
17 
18 #include <QSettings>
19 
21  : mName( name )
22 {
23 }
24 
26 {
27 }
28 
30 {
31  return mName;
32 }
33 
34 QgsEditorWidgetConfig QgsEditorWidgetFactory::readEditorConfig( const QDomElement& configElement, QgsVectorLayer* layer, int fieldIdx )
35 {
36  return readConfig( configElement, layer, fieldIdx );
37 }
38 
39 void QgsEditorWidgetFactory::writeConfig( const QgsEditorWidgetConfig& config, QDomElement& configElement, QDomDocument& doc, const QgsVectorLayer* layer, int fieldIdx )
40 {
41  Q_UNUSED( config );
42  Q_UNUSED( configElement );
43  Q_UNUSED( doc );
44  Q_UNUSED( layer );
45  Q_UNUSED( fieldIdx );
46 }
47 
48 QString QgsEditorWidgetFactory::representValue( QgsVectorLayer* vl, int fieldIdx, const QgsEditorWidgetConfig& config, const QVariant& cache, const QVariant& value ) const
49 {
50  Q_UNUSED( vl )
51  Q_UNUSED( fieldIdx )
52  Q_UNUSED( config )
53  Q_UNUSED( cache )
54  Q_UNUSED( value )
55 
56  const QgsField &fld = vl->pendingFields().at( fieldIdx );
57  return fld.displayString( value );
58 }
59 
60 QVariant QgsEditorWidgetFactory::createCache( QgsVectorLayer* vl, int fieldIdx, const QgsEditorWidgetConfig& config )
61 {
62  Q_UNUSED( vl )
63  Q_UNUSED( fieldIdx )
64  Q_UNUSED( config )
65 
66  return QVariant();
67 }
68 
69 QgsEditorWidgetConfig QgsEditorWidgetFactory::readConfig( const QDomElement& configElement, QgsVectorLayer* layer, int fieldIdx )
70 {
71  Q_UNUSED( configElement );
72  Q_UNUSED( layer );
73  Q_UNUSED( fieldIdx );
74 
75  return QgsEditorWidgetConfig();
76 }
77 
78 bool QgsEditorWidgetFactory::isFieldSupported( QgsVectorLayer* vl, int fieldIdx )
79 {
80  Q_UNUSED( vl )
81  Q_UNUSED( fieldIdx )
82  return true;
83 }
84