[Development] QtQml value types
Alberto Mardegan
mardy at users.sourceforge.net
Fri Apr 25 12:51:54 CEST 2014
On 04/24/2014 03:11 PM, Joshua Kolden wrote:
[...]
> We have a solution that works very well for us using QVariantMaps and an
> MVC pattern / strong separation between data objects and view. It
> appears to me that most people are having this issue because it’s not
> common to use MVC with QtWidgets. But you can easily expose complex
> data structures to QtQuick without subclassing QObject via QVariantMaps.
[...]
While your proposed approach is rather clean, it carries one drawback,
which is the lack of type information, with all its consequences.
For instance, I would like to have a GeoPoint type with "latitude" and
"longitude" properties; if I exposed it as a QVariantMap, I wouldn't be
able to prevent the QML code from doing stuff like:
p.latitude = 60
p.longitde = 10 // note the typo
Ciao,
Alberto
--
http://blog.mardy.it <- geek in un lingua international!
More information about the Development
mailing list