FB2 fixes

This commit is contained in:
Agel committed 2026-04-17 22:33:36 +02:00
1 parent 7fdd56a7f5
commit 232d86716d
4 files changed
+28 -7

No files matched your search

+4 -1
View File
@@ -169,8 +169,9 @@ int main(int argc, char *argv[])
readingModel.setFontParams(readingPreferences.fontSize(), readingPreferences.lineSpacing());
});
// Track the current image provider so setContentWidth can reach it
// Track the current image provider and content width so both stay in sync.
IImageProvider *currentImageProvider = nullptr;
int currentContentWidth = 0;
// Before a new book open: snapshot the outgoing book's progress into the library.
// Scroll position is handled by PageView's scroll tracker via book.saveCurrentPosition().
@@ -201,6 +202,7 @@ int main(int argc, char *argv[])
engine.removeImageProvider(provider->scheme());
engine.addImageProvider(provider->scheme(), provider);
provider->setFilePath(filePath);
provider->setDisplayWidth(currentContentWidth);
currentImageProvider = provider;
if (!reader->coverImagePath().isEmpty())
@@ -220,6 +222,7 @@ int main(int argc, char *argv[])
// Propagate content-width changes to image provider + reading model.
// Called from Book::setContentWidth which is triggered by QML's PageView.
QObject::connect(&book, &Book::contentWidthChanged, [&](int width){
currentContentWidth = width;
if (currentImageProvider)
currentImageProvider->setDisplayWidth(width);
readingModel.setContentWidth(width);