Hello, I have an app which has a save functionality. I keep application states on QObject-derived class objects and to save the state I use QVariant's operator<<(). I do this for all the properties of the object. So I use a loop like this for all my objects:
for (int i = 0; i < metaObj->propertyCount(); ++i) if (metaObj->property(i).isStored(obj)) { QVariant var(metaObj->property(i).read(obj)); ds << var; } But some of my objects are QQuickItem-derived. These objects have some additional properties, such as *parent*, or private properties like *data *or *anchors*, for whose types the stream operators are not registered. Normally I compile my project on Linux. But yesterday I tried to compile it on Windows. On Linux, QVariant::save function was giving the warning message "QVariant::save: unable to save type ..." for those properties of QQuickItem, yet the application kept running. On Windows, however, it not only gives a warning message but also reports a _CRT_ERROR. I understand this is the expected situation for debug builds, as documented in the qFatal documentation. Although I won't receive this error for release builds, leaving my code this way still feels a bit sloppy. So I would like to ask if there is a way to check if the stream operators are registered for a particular type or not. Or maybe saving the state of a QObject-derived class should be done in another way? Thanks, Sina
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest