restore opened file and position

This commit is contained in:
Agel committed 2026-03-16 15:34:15 +01:00
1 parent fcacd0495d
commit 2ecf9f4178
12 files changed
+491 -11

No files matched your search

+9
View File
@@ -21,6 +21,7 @@ int main(int argc, char *argv[])
bookController.setReadingModel(&readingModel);
AppState appState;
appState.restore();
QQmlApplicationEngine engine;
@@ -34,5 +35,13 @@ int main(int argc, char *argv[])
Qt::QueuedConnection);
engine.load(url);
QObject::connect(&app, &QCoreApplication::aboutToQuit, [&]() {
if (bookController.hasBook()) {
appState.setLastFilePath(bookController.currentFilePath());
appState.setLastChapter(readingModel.currentChapter());
}
appState.save();
});
return app.exec();
}