summaryrefslogtreecommitdiffstats
path: root/src/pdf/quick/qquickpdfnavigationstack.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-02-05 10:56:48 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-02-11 08:29:53 +0100
commit7afe95f14d7d048a73baa12b3bd5f6a9bcea2ccb (patch)
treee264172edcc5869acccd66217b5bd92f63576309 /src/pdf/quick/qquickpdfnavigationstack.cpp
parent92cd38cd4a24e344492c2dd8a7a63e9dacf10553 (diff)
PDF multipage view: track specific link and navigation destinations
Unfortunately it's getting harder to do things declaratively, because we have to avoid circular bindings, and because of needing to use imperative APIs. The current-page spinbox provides onValueModified() to detect when the user modifies it, distinct from the simple fact that the value changed. We shouldn't make bindings to set ListView.currentIndex anyway, because that results in slow animation (and loading pages in all delegates along the way) rather than quick jumping to the correct page. Instead we need to use ListView.positionViewAtIndex(), another imperative API, to get quick jumps without having to calculate and set contentY in some other way. Now we move toward the NavigationStack providing storage for the current destination at all times. Changes there will trigger programmatically moving the ListView. When the user scrolls manually, that generates a "destination" in the navigation stack, such that the back button can jump back to the previous location, and then the forward button can return to the destination where manual scrolling ended up. Fixes: QTBUG-77510 Change-Id: I47544210d2e0f9aa790f3d2594839678374e463d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/pdf/quick/qquickpdfnavigationstack.cpp')
-rw-r--r--src/pdf/quick/qquickpdfnavigationstack.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/pdf/quick/qquickpdfnavigationstack.cpp b/src/pdf/quick/qquickpdfnavigationstack.cpp
index 57acdc4bc..51f65f032 100644
--- a/src/pdf/quick/qquickpdfnavigationstack.cpp
+++ b/src/pdf/quick/qquickpdfnavigationstack.cpp
@@ -56,6 +56,7 @@ Q_LOGGING_CATEGORY(qLcNav, "qt.pdf.navigationstack")
QQuickPdfNavigationStack::QQuickPdfNavigationStack(QObject *parent)
: QObject(parent)
{
+ push(0, QPointF(), 1);
}
/*!