@@ -44,9 +44,10 @@ QgsField::QgsField( QString nam, QString typ, int len, int prec, bool num,
44
44
}
45
45
#endif
46
46
QgsField::QgsField ( const QString& name, QVariant::Type type,
47
- const QString& typeName, int len, int prec, const QString& comment )
47
+ const QString& typeName, int len, int prec, const QString& comment,
48
+ QVariant::Type subType )
48
49
{
49
- d = new QgsFieldPrivate ( name, type, typeName, len, prec, comment );
50
+ d = new QgsFieldPrivate ( name, type, subType, typeName, len, prec, comment );
50
51
}
51
52
52
53
QgsField::QgsField ( const QgsField &other )
@@ -99,6 +100,11 @@ QVariant::Type QgsField::type() const
99
100
return d->type ;
100
101
}
101
102
103
+ QVariant::Type QgsField::subType () const
104
+ {
105
+ return d->subType ;
106
+ }
107
+
102
108
QString QgsField::typeName () const
103
109
{
104
110
return d->typeName ;
@@ -140,6 +146,11 @@ void QgsField::setType( QVariant::Type type )
140
146
d->type = type;
141
147
}
142
148
149
+ void QgsField::setSubType ( QVariant::Type subType )
150
+ {
151
+ d->subType = subType;
152
+ }
153
+
143
154
void QgsField::setTypeName ( const QString& typeName )
144
155
{
145
156
d->typeName = typeName;
@@ -292,14 +303,15 @@ QDataStream& operator<<( QDataStream& out, const QgsField& field )
292
303
out << field.comment ();
293
304
out << field.alias ();
294
305
out << field.defaultValueExpression ();
306
+ out << static_cast < quint32 >( field.subType () );
295
307
return out;
296
308
}
297
309
298
310
QDataStream& operator >>( QDataStream& in, QgsField& field )
299
311
{
300
- quint32 type, length, precision;
312
+ quint32 type, subType, length, precision;
301
313
QString name, typeName, comment, alias, defaultValueExpression;
302
- in >> name >> type >> typeName >> length >> precision >> comment >> alias >> defaultValueExpression;
314
+ in >> name >> type >> typeName >> length >> precision >> comment >> alias >> defaultValueExpression >> subType ;
303
315
field.setName ( name );
304
316
field.setType ( static_cast < QVariant::Type >( type ) );
305
317
field.setTypeName ( typeName );
@@ -308,6 +320,7 @@ QDataStream& operator>>( QDataStream& in, QgsField& field )
308
320
field.setComment ( comment );
309
321
field.setAlias ( alias );
310
322
field.setDefaultValueExpression ( defaultValueExpression );
323
+ field.setSubType ( static_cast < QVariant::Type >( subType ) );
311
324
return in;
312
325
}
313
326
0 commit comments