Sérialization, QVariant et QSettings : unable*to*load*type 257
Hello
I experience issues when running my application
I have personnal object (ChannelObjectSerializable) which I want to save status.
Here is part of the code which will help :
After the sync() :
Code:
QVariant::load: unable to load type 257.
QVariant::save: unable to save type 257.
QVariant::load: unable to load type 257.
#####################
# Channel :
# #
# #
# #
# #
# #
#####################
Avec :
ChannelObjectSerilizable.h
Code:
private:
};
Q_DECLARE_METATYPE(ChannelObjectSerializable)
ChannelObjectSerializable.cpp :
Code:
void ChannelObjectSerializable::initChannelSystem()
{
qRegisterMetaTypeStreamOperators("ChannelObject");
qMetaTypeId();
}
{
out << tmp.fromStdString(Valeur.nom)
<< tmp.fromStdString(Valeur.lastUpdate)
<< tmp.fromStdString(Valeur.description)
<< tmp.fromStdString(Valeur.lien)
<< tmp.fromStdString(Valeur.link);
return out;
}
{
in >> tmp;
Valeur.nom = tmp.toStdString();
in >> tmp;
Valeur.lastUpdate = tmp.toStdString();
in >> tmp;
Valeur.description = tmp.toStdString();
in >> tmp;
Valeur.lien = tmp.toStdString();
in >> tmp;
Valeur.link = tmp.toStdString();
return in;
}
main.cpp
Code:
ChannelObjectSerializable p = ChannelObjectSerializable(newRSS);
p.initChannelSystem();
fichier_ecrire.setValue("channel", qVariantFromValue(p));
p.printDonnees();
fichier_ecrire.sync();
ChannelObjectSerializable copie;
copie = fichier_lire.value("channel", qVariantFromValue(ChannelObjectSerializable())).value();
copie.printDonnees();
After loading the object, it's empty
Re: Sérialization, QVariant et QSettings : unable*to*load*type 257