Open nyalldawson opened 8 years ago
I haven't checked the code but I'm pretty sure it would avoid bugs like this: http://hub.qgis.org/issues/15367
I haven't checked the code but I'm pretty sure it would avoid bugs like this: http://hub.qgis.org/issues/15367
Yes, that's exactly the type of bug this is intended to avoid.
@wonder-sk I'm keen to hear your thoughts on this before I proceed
Is the idea to just switch from QVariant::Type to a constrained enumeration of possible types (and keep QVariant as the storage) or did you mean to replace QVariant completely with our own variant type tailored for attribute values?
the idea to just switch from QVariant::Type to a constrained enumeration of possible types (and keep QVariant as the storage)
Yes, so a subset of Qt's inbuilt types + sensible custom types we've registered as metaphors.
did you mean to replace QVariant completely with our own variant type tailored for attribute values
Oh hell no...! I think I've just done enough search and replace to last me till the next api break :p
@nyalldawson if you're not a pure terminal freak, I like regexxer a lot!
@nyalldawson Sounds good to me...
Here's the ones I'd keep:
Agreed?
Why not merge Int and LongLong UInt and ULongLong ? And maybe even Time and DateTime (nah, forget about that)?
I'd be in favour, but I guess it depends on whether those type differences are important to providers. Time and datetime are very different (eg tab files, postgres types), so I don't want to merge those.
Oh BTW, I was thinking we should have a QgsFields::isNumeric( int index ) const
and bool QgsField::isNumeric() const
method too.
The list of types looks good, I would probably just skip UInt and ULongLong to keep things simpler...
What do you think about leaving the current type information in place and rename QgsField::type() to QgsField::complexType() while offering a second method QgsField::simpleType() (which internally has a switch over the complex type)?
And instead use our own enum of supported field types. Here's the reasons this may be a good move: