Hello world, I am working on a project where i can serialize a n object in a file and read it later but when i write the values(boolean value), it works but when i try to read them, this is what i get:
binary '>>' : no operator found which takes a right-hand operand of type bool(or there is no acceptable conversion)
This is my code
void MainWindow::writeSettings()
{
QFile *settingsFile = new QFile(":/images/settings_file.txt");
if(!settingsFile->open(QIODevice::WriteOnly))
{
qDebug() << "File not responsing";
} else
{
QDataStream out(settingsFile);
out.setVersion(QDataStream::Qt_5_3);
out << settings->getEnableWordWrap();
out << settings->getShowStatusbar();
out << settings->getShowToolbar();
}
settingsFile->flush();
settingsFile->close();
}
Now if i try to read, get the error
QFile selc(":/images/settings_file.txt");
if(!selc.open(QIODevice::ReadOnly))
{
qDebug() << "File not responding";
} else
{
QDataStream in(&selc);
in >> settings->getEnableWordWrap() >> settings->getShowStatusbar() >> settings->getShowToolbar();
}
selc.close();
getEnableWordWrap()
, getShowStatusbar()
and getShowToolbar()
are all boolean return types.