MCPcopy Create free account
hub / github.com/YACReader/yacreader / applyContinuousStateToUi

Method applyContinuousStateToUi

YACReader/viewer.cpp:1386–1413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1384}
1385
1386void Viewer::applyContinuousStateToUi()
1387{
1388 if (!continuousScroll) {
1389 return;
1390 }
1391
1392 // Save/restore both guards: this can run re-entrantly (e.g. setActiveWidget's
1393 // setWidget triggers a viewport resize -> setViewportSize -> recompute -> here).
1394 // Unconditionally clearing them would defeat an outer block: setActiveWidget
1395 // blocks the scrollbar so setWidget's reset-to-0 won't fire onContinuousScroll;
1396 // if we unblock it here, that reset then snaps reading progress to the cover.
1397 const bool wasApplying = applyingContinuousModelState;
1398 applyingContinuousModelState = true;
1399
1400 continuousWidget->setFixedHeight(continuousViewModel->totalHeight());
1401 continuousWidget->updateGeometry();
1402
1403 auto *sb = verticalScrollBar();
1404 const int target = qBound(sb->minimum(), continuousViewModel->scrollY(), sb->maximum());
1405 const bool wasBlocked = sb->blockSignals(true);
1406 sb->setValue(target);
1407 sb->blockSignals(wasBlocked);
1408
1409 applyingContinuousModelState = wasApplying;
1410
1411 continuousWidget->update();
1412 viewport()->update();
1413}
1414
1415void Viewer::scrollToCurrentContinuousPage()
1416{

Callers

nothing calls this directly

Calls 4

totalHeightMethod · 0.80
scrollYMethod · 0.80
setValueMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected