| 1384 | } |
| 1385 | |
| 1386 | void 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 | |
| 1415 | void Viewer::scrollToCurrentContinuousPage() |
| 1416 | { |
nothing calls this directly
no test coverage detected