src/documentmanager.cpp

changeset 328
3ea38fd469ca
parent 264
76a025db4948
child 329
6d75fa09cc0c
--- a/src/documentmanager.cpp	Sun Jul 03 22:32:50 2022 +0300
+++ b/src/documentmanager.cpp	Sun Jul 03 23:54:22 2022 +0300
@@ -121,7 +121,7 @@
 	file.open(QFile::ReadOnly | QFile::Text);
 	std::unique_ptr<Model> newModel = std::make_unique<Model>(nullptr);
 	QTextStream textStream{&file};
-	Parser parser{file};
+	Parser parser{textStream};
 	parser.parseBody(*newModel);
 	std::optional<ModelId> result;
 	if (file.error() == QFile::NoError)
@@ -195,7 +195,8 @@
 		QSaveFile file{info->path};
 		file.setDirectWriteFallback(true);
 		if (file.open(QSaveFile::WriteOnly)) {
-			::save(*info->model.get(), &file);
+			QTextStream stream{&file};
+			::save(*info->model.get(), &stream);
 			const bool commitSucceeded = file.commit();
 			if (not commitSucceeded) {
 				errors << QObject::tr("Could not save: %1").arg(file.errorString());

mercurial