Kwakkie
2nd May 2016, 14:10
Hi all
We've been using Qt 4.8.x for some time now. But now we want to upgrade to 5.5.1. Part of our application is using QGeoCoordinate. In 4.8, this was part of the QtMobility namespace. Of course, in 5.5.1 this is now part of the positioning module.
Our application saves the QtMobility::QGeoCoordinate information to a file using a stream, and was able to read it back in. For this, we had these in our code to be able to use the stream and put the QGeoCoordinate in a QVariant.
Q_DECLARE_METATYPE(QtMobility::QGeoCoordinate);
qRegisterMetaType<QtMobility::QGeoCoordinate>("QtMobility::QGeoCoordinate");
qRegisterMetaTypeStreamOperators<QtMobility::QGeoCoordinate>("QtMobility::QGeoCoordinate");
So now that QtMobility::QGeoCoordinate changed to the proper QGeoCoordinate, the loading of old streamed files results in:
"Trying to construct an instance of an invalid type, type id: 127
QVariant::load: unable to load type 42."
And eventually a crash.
Is there any way to solve this? I tried declaring the metatype and streaming metatype to something like
qRegisterMetaType<QGeoCoordinate>("QtMobility::QGeoCoordinate");
qRegisterMetaTypeStreamOperators<QGeoCoordinate>("QtMobility::QGeoCoordinate");
And other things, but nothing seems to work.
Added after 1 5 minutes:
Thinking about this, what about all custom classes with serialization that contain QGeoCoordinate? How will these be handled? I have lots of these, each declared and registered... How will the QVariant metatypes be handled?
We've been using Qt 4.8.x for some time now. But now we want to upgrade to 5.5.1. Part of our application is using QGeoCoordinate. In 4.8, this was part of the QtMobility namespace. Of course, in 5.5.1 this is now part of the positioning module.
Our application saves the QtMobility::QGeoCoordinate information to a file using a stream, and was able to read it back in. For this, we had these in our code to be able to use the stream and put the QGeoCoordinate in a QVariant.
Q_DECLARE_METATYPE(QtMobility::QGeoCoordinate);
qRegisterMetaType<QtMobility::QGeoCoordinate>("QtMobility::QGeoCoordinate");
qRegisterMetaTypeStreamOperators<QtMobility::QGeoCoordinate>("QtMobility::QGeoCoordinate");
So now that QtMobility::QGeoCoordinate changed to the proper QGeoCoordinate, the loading of old streamed files results in:
"Trying to construct an instance of an invalid type, type id: 127
QVariant::load: unable to load type 42."
And eventually a crash.
Is there any way to solve this? I tried declaring the metatype and streaming metatype to something like
qRegisterMetaType<QGeoCoordinate>("QtMobility::QGeoCoordinate");
qRegisterMetaTypeStreamOperators<QGeoCoordinate>("QtMobility::QGeoCoordinate");
And other things, but nothing seems to work.
Added after 1 5 minutes:
Thinking about this, what about all custom classes with serialization that contain QGeoCoordinate? How will these be handled? I have lots of these, each declared and registered... How will the QVariant metatypes be handled?