Don't mix up APIs. Either stick to Qt APIs on all platforms or use your custom (or legacy) on all platform.
Don't mix up APIs. Either stick to Qt APIs on all platforms or use your custom (or legacy) on all platform.
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
So if I understand correctly you are not actually creating a Qt API for something but you are backing a compatibility shim of sorts by Qt code, right?
And you shim function has to return a typed value or at least a type on request?
While that sounds very painful to maintain long term, you probably have reasons not to do a clean port.
As far as I can see you have to options:
1) use a backend that contains the type information just like the original API's backend does
2) use a type-less backend and try to find the closest type by trying potental conversion
Cheers,
_
That is correct for both questions!
What is a backend?
Are you referring to QSettings::SetIniCodec?
I have an idea, I have seen QT add quotes at one time to. I think it was when I played with QSringList.
Thinking of storing strings as QStringList of length 0. QVariant::type() will probably return the correct value.
I have a working solution which was simpler than expected.
When writing string values to the INI file, I append "\"STRING" to the string
When reading generic values. If the QVariant is a string without the above prefix I assume it's an int.
Works like a charm.
Many thanks to all of you!
Last edited by yaronkle; 15th October 2013 at 09:31.
Bookmarks