summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2022-04-24 10:54:05 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2022-05-27 14:20:50 +0200
commit90f43fd25ec4de4d18da40c214ddb366da5c798a (patch)
tree3cdc847db7f455134c174c02e2d5f13a07ef54de
parent567739fda232c28992962f32a9e652eab723a4d4 (diff)
Rename QPdfNavigationStack to QPdfPageNavigator; QML type too
This might reduce some confusion about the fact that the back/forward "stack" isn't strictly a stack in the data structure sense: it's more like QUndoStack. It causes a QML source incompatibility relative to Qt 5, but keeps the C++ class name the same as it has been in QtPdf for a long time. Amends 3ad445f9f24a9d3f259ed1781460a63346a728e4 [ChangeLog][QtPDF] The PdfNavigationStack QML type has been renamed to PdfPageNavigator, matching the C++ type QPdfPageNavigator. These remember navigation history within a document, and are helpful to implement back/forward buttons similar to those on a web browser in both Qt Quick and widget-based viewer applications. Change-Id: Id8dc17aa416bb7064b1f0f300a47c07c83b7f47e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r--examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc2
-rw-r--r--examples/pdfwidgets/pdfviewer/mainwindow.cpp22
-rw-r--r--src/pdf/CMakeLists.txt2
-rw-r--r--src/pdf/doc/src/qtpdf-index.qdoc4
-rw-r--r--src/pdf/qpdflink.h2
-rw-r--r--src/pdf/qpdfpagenavigator.cpp (renamed from src/pdf/qpdfnavigationstack.cpp)52
-rw-r--r--src/pdf/qpdfpagenavigator.h (renamed from src/pdf/qpdfnavigationstack.h)18
-rw-r--r--src/pdfquick/CMakeLists.txt2
-rw-r--r--src/pdfquick/PdfMultiPageView.qml50
-rw-r--r--src/pdfquick/PdfPageView.qml46
-rw-r--r--src/pdfquick/PdfScrollablePageView.qml58
-rw-r--r--src/pdfquick/qquickpdfpagenavigator.cpp (renamed from src/pdfquick/qquickpdfnavigationstack.cpp)38
-rw-r--r--src/pdfquick/qquickpdfpagenavigator_p.h (renamed from src/pdfquick/qquickpdfnavigationstack_p.h)24
-rw-r--r--src/pdfwidgets/qpdfview.cpp22
-rw-r--r--src/pdfwidgets/qpdfview.h4
-rw-r--r--src/pdfwidgets/qpdfview_p.h2
-rw-r--r--tests/auto/pdf/CMakeLists.txt2
17 files changed, 175 insertions, 175 deletions
diff --git a/examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc b/examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc
index a053f734c..f52e327a2 100644
--- a/examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc
+++ b/examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc
@@ -37,7 +37,7 @@
\endomit
\e {PDF Viewer} demonstrates how to use the QPdfView class to render
- PDF documents and the QPdfNavigationStack class to navigate them.
+ PDF documents and the QPdfPageNavigator class to navigate them.
Qt Creator and the integrated Qt Designer were used to create the example
UI and to connect it to the code. This affects the code, which might be
diff --git a/examples/pdfwidgets/pdfviewer/mainwindow.cpp b/examples/pdfwidgets/pdfviewer/mainwindow.cpp
index c6747f980..a6a533d51 100644
--- a/examples/pdfwidgets/pdfviewer/mainwindow.cpp
+++ b/examples/pdfwidgets/pdfviewer/mainwindow.cpp
@@ -58,7 +58,7 @@
#include <QSpinBox>
#include <QPdfBookmarkModel>
#include <QPdfDocument>
-#include <QPdfNavigationStack>
+#include <QPdfPageNavigator>
#include <QtMath>
const qreal zoomMultiplier = qSqrt(2.0);
@@ -79,10 +79,10 @@ MainWindow::MainWindow(QWidget *parent)
ui->mainToolBar->insertWidget(ui->actionForward, m_pageSelector);
connect(m_pageSelector, &QSpinBox::valueChanged, this, &MainWindow::pageSelected);
- auto nav = ui->pdfView->pageNavigation();
- connect(nav, &QPdfNavigationStack::currentPageChanged, m_pageSelector, &QSpinBox::setValue);
- connect(nav, &QPdfNavigationStack::backAvailableChanged, ui->actionBack, &QAction::setEnabled);
- connect(nav, &QPdfNavigationStack::forwardAvailableChanged, ui->actionForward, &QAction::setEnabled);
+ auto nav = ui->pdfView->pageNavigator();
+ connect(nav, &QPdfPageNavigator::currentPageChanged, m_pageSelector, &QSpinBox::setValue);
+ connect(nav, &QPdfPageNavigator::backAvailableChanged, ui->actionBack, &QAction::setEnabled);
+ connect(nav, &QPdfPageNavigator::forwardAvailableChanged, ui->actionForward, &QAction::setEnabled);
connect(m_zoomSelector, &ZoomSelector::zoomModeChanged, ui->pdfView, &QPdfView::setZoomMode);
connect(m_zoomSelector, &ZoomSelector::zoomFactorChanged, ui->pdfView, &QPdfView::setZoomFactor);
@@ -129,12 +129,12 @@ void MainWindow::bookmarkSelected(const QModelIndex &index)
const int page = index.data(int(QPdfBookmarkModel::Role::Page)).toInt();
const qreal zoomLevel = index.data(int(QPdfBookmarkModel::Role::Level)).toReal();
- ui->pdfView->pageNavigation()->jump(page, {}, zoomLevel);
+ ui->pdfView->pageNavigator()->jump(page, {}, zoomLevel);
}
void MainWindow::pageSelected(int page)
{
- auto nav = ui->pdfView->pageNavigation();
+ auto nav = ui->pdfView->pageNavigator();
nav->jump(page, {}, nav->currentZoom());
}
@@ -173,13 +173,13 @@ void MainWindow::on_actionZoom_Out_triggered()
void MainWindow::on_actionPrevious_Page_triggered()
{
- auto nav = ui->pdfView->pageNavigation();
+ auto nav = ui->pdfView->pageNavigator();
nav->jump(nav->currentPage() - 1, {}, nav->currentZoom());
}
void MainWindow::on_actionNext_Page_triggered()
{
- auto nav = ui->pdfView->pageNavigation();
+ auto nav = ui->pdfView->pageNavigator();
nav->jump(nav->currentPage() + 1, {}, nav->currentZoom());
}
@@ -192,10 +192,10 @@ void MainWindow::on_actionContinuous_triggered()
void MainWindow::on_actionBack_triggered()
{
- ui->pdfView->pageNavigation()->back();
+ ui->pdfView->pageNavigator()->back();
}
void MainWindow::on_actionForward_triggered()
{
- ui->pdfView->pageNavigation()->forward();
+ ui->pdfView->pageNavigator()->forward();
}
diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt
index 05b4424a9..ed2da1032 100644
--- a/src/pdf/CMakeLists.txt
+++ b/src/pdf/CMakeLists.txt
@@ -20,7 +20,7 @@ qt_internal_add_module(Pdf
qpdffile.cpp qpdffile_p.h
qpdflink.cpp qpdflink.h qpdflink_p.h
qpdflinkmodel.cpp qpdflinkmodel_p.h qpdflinkmodel_p_p.h
- qpdfnavigationstack.cpp qpdfnavigationstack.h
+ qpdfpagenavigator.cpp qpdfpagenavigator.h
qpdfpagerenderer.cpp qpdfpagerenderer.h
qpdfsearchmodel.cpp qpdfsearchmodel.h qpdfsearchmodel_p.h
qpdfselection.cpp qpdfselection.h qpdfselection_p.h
diff --git a/src/pdf/doc/src/qtpdf-index.qdoc b/src/pdf/doc/src/qtpdf-index.qdoc
index a03146569..986a8011b 100644
--- a/src/pdf/doc/src/qtpdf-index.qdoc
+++ b/src/pdf/doc/src/qtpdf-index.qdoc
@@ -36,7 +36,7 @@
and renders pages from it according to the options provided by
the \l QPdfDocumentRenderOptions class. The \l QPdfPageRenderer
class manages a queue that collects all render requests. The
- \l QPdfNavigationStack class handles the navigation through a
+ \l QPdfPageNavigator class handles the navigation through a
PDF document. The \l QPdfSearchModel class searches for a string
and holds the search results. The \l QPdfView widget is a complete
PDF viewer, and the \l {PDF Viewer Example} shows how to use it.
@@ -51,7 +51,7 @@
The full-featured viewer components are composed of lower-level
QML components that can be used separately if you need to write a
more customized PDF viewing application: \l PdfDocument,
- \l PdfPageImage, \l PdfNavigationStack, \l PdfSelection,
+ \l PdfPageImage, \l PdfPageNavigator, \l PdfSelection,
\l PdfSearchModel, \l PdfLinkModel, and \l PdfBookmarkModel.
If you only need to render page images, without features such as
diff --git a/src/pdf/qpdflink.h b/src/pdf/qpdflink.h
index 81053b42a..69f7f25a9 100644
--- a/src/pdf/qpdflink.h
+++ b/src/pdf/qpdflink.h
@@ -88,7 +88,7 @@ private: // methods
QPdfLink(QPdfLinkPrivate *d);
friend class QPdfDocument;
friend class QPdfSearchModelPrivate;
- friend class QQuickPdfNavigationStack;
+ friend class QQuickPdfPageNavigator;
private: // storage
QExplicitlySharedDataPointer<QPdfLinkPrivate> d;
diff --git a/src/pdf/qpdfnavigationstack.cpp b/src/pdf/qpdfpagenavigator.cpp
index 5a154ee38..356f671e0 100644
--- a/src/pdf/qpdfnavigationstack.cpp
+++ b/src/pdf/qpdfpagenavigator.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "qpdfnavigationstack.h"
+#include "qpdfpagenavigator.h"
#include "qpdfdocument.h"
#include "qpdflink_p.h"
@@ -46,11 +46,11 @@
QT_BEGIN_NAMESPACE
-Q_LOGGING_CATEGORY(qLcNav, "qt.pdf.navigationstack")
+Q_LOGGING_CATEGORY(qLcNav, "qt.pdf.pagenavigator")
-struct QPdfNavigationStackPrivate
+struct QPdfPageNavigatorPrivate
{
- QPdfNavigationStack *q = nullptr;
+ QPdfPageNavigator *q = nullptr;
QList<QExplicitlySharedDataPointer<QPdfLinkPrivate>> pageHistory;
int currentHistoryIndex = 0;
@@ -58,12 +58,12 @@ struct QPdfNavigationStackPrivate
};
/*!
- \class QPdfNavigationStack
+ \class QPdfPageNavigator
\since 6.4
\inmodule QtPdf
\brief Navigation history within a PDF document.
- The QPdfNavigationStack class remembers which destinations the user
+ The QPdfPageNavigator class remembers which destinations the user
has visited in a PDF document, and provides the ability to traverse
backward and forward. It is used to implement back and forward actions
similar to the back and forward buttons in a web browser.
@@ -74,8 +74,8 @@ struct QPdfNavigationStackPrivate
/*!
Constructs a page navigation stack with parent object \a parent.
*/
-QPdfNavigationStack::QPdfNavigationStack(QObject *parent)
- : QObject(parent), d(new QPdfNavigationStackPrivate)
+QPdfPageNavigator::QPdfPageNavigator(QObject *parent)
+ : QObject(parent), d(new QPdfPageNavigatorPrivate)
{
d->q = this;
clear();
@@ -84,7 +84,7 @@ QPdfNavigationStack::QPdfNavigationStack(QObject *parent)
/*!
Destroys the page navigation stack.
*/
-QPdfNavigationStack::~QPdfNavigationStack()
+QPdfPageNavigator::~QPdfPageNavigator()
{
}
@@ -96,7 +96,7 @@ QPdfNavigationStack::~QPdfNavigationStack()
the forward() function does nothing, because there is a branch in the
timeline which causes the "future" to be lost.
*/
-void QPdfNavigationStack::forward()
+void QPdfPageNavigator::forward()
{
if (d->currentHistoryIndex >= d->pageHistory.count() - 1)
return;
@@ -126,7 +126,7 @@ void QPdfNavigationStack::forward()
\l currentZoom properties to the most-recently-viewed destination, and then
emits the \l jumped() signal.
*/
-void QPdfNavigationStack::back()
+void QPdfPageNavigator::back()
{
if (d->currentHistoryIndex <= 0)
return;
@@ -151,12 +151,12 @@ void QPdfNavigationStack::back()
<< "@" << currentLocation() << "zoom" << currentZoom();
}
/*!
- \property QPdfNavigationStack::currentPage
+ \property QPdfPageNavigator::currentPage
This property holds the current page that is being viewed.
The default is \c 0.
*/
-int QPdfNavigationStack::currentPage() const
+int QPdfPageNavigator::currentPage() const
{
if (d->currentHistoryIndex < 0 || d->currentHistoryIndex >= d->pageHistory.count())
return -1; // only until ctor or clear() runs
@@ -164,13 +164,13 @@ int QPdfNavigationStack::currentPage() const
}
/*!
- \property QPdfNavigationStack::currentLocation
+ \property QPdfPageNavigator::currentLocation
This property holds the current location on the page that is being viewed
(the location that was last given to jump() or update()). The default is
\c {0, 0}.
*/
-QPointF QPdfNavigationStack::currentLocation() const
+QPointF QPdfPageNavigator::currentLocation() const
{
if (d->currentHistoryIndex < 0 || d->currentHistoryIndex >= d->pageHistory.count())
return QPointF();
@@ -178,12 +178,12 @@ QPointF QPdfNavigationStack::currentLocation() const
}
/*!
- \property QPdfNavigationStack::currentZoom
+ \property QPdfPageNavigator::currentZoom
This property holds the magnification scale (1 logical pixel = 1 point)
on the page that is being viewed. The default is \c 1.
*/
-qreal QPdfNavigationStack::currentZoom() const
+qreal QPdfPageNavigator::currentZoom() const
{
if (d->currentHistoryIndex < 0 || d->currentHistoryIndex >= d->pageHistory.count())
return 1;
@@ -194,7 +194,7 @@ qreal QPdfNavigationStack::currentZoom() const
Clear the history and restore \l currentPage, \l currentLocation and
\l currentZoom to their default values.
*/
-void QPdfNavigationStack::clear()
+void QPdfPageNavigator::clear()
{
d->pageHistory.clear();
d->currentHistoryIndex = 0;
@@ -220,7 +220,7 @@ void QPdfNavigationStack::clear()
in the timeline which causes the "future" to be lost, and therefore
forwardAvailable will change to \c false.
*/
-void QPdfNavigationStack::jump(int page, const QPointF &location, qreal zoom)
+void QPdfPageNavigator::jump(int page, const QPointF &location, qreal zoom)
{
if (page == currentPage() && location == currentLocation() && zoom == currentZoom())
return;
@@ -273,7 +273,7 @@ void QPdfNavigationStack::jump(int page, const QPointF &location, qreal zoom)
The \l jumped signal is not emitted, because this operation represents
smooth movement rather than a navigational jump.
*/
-void QPdfNavigationStack::update(int page, const QPointF &location, qreal zoom)
+void QPdfPageNavigator::update(int page, const QPointF &location, qreal zoom)
{
if (d->currentHistoryIndex < 0 || d->currentHistoryIndex >= d->pageHistory.count())
return;
@@ -302,31 +302,31 @@ void QPdfNavigationStack::update(int page, const QPointF &location, qreal zoom)
}
/*!
- \property QPdfNavigationStack::backAvailable
+ \property QPdfPageNavigator::backAvailable
\readonly
Holds \c true if a \e back destination is available in the history:
that is, if push() or forward() has been called.
*/
-bool QPdfNavigationStack::backAvailable() const
+bool QPdfPageNavigator::backAvailable() const
{
return d->currentHistoryIndex > 0;
}
/*!
- \property QPdfNavigationStack::forwardAvailable
+ \property QPdfPageNavigator::forwardAvailable
\readonly
Holds \c true if a \e forward destination is available in the history:
that is, if back() has been previously called.
*/
-bool QPdfNavigationStack::forwardAvailable() const
+bool QPdfPageNavigator::forwardAvailable() const
{
return d->currentHistoryIndex < d->pageHistory.count() - 1;
}
/*!
- \fn void QPdfNavigationStack::jumped(int page, const QPointF &location, qreal zoom)
+ \fn void QPdfPageNavigator::jumped(int page, const QPointF &location, qreal zoom)
This signal is emitted when an abrupt jump occurs, to the specified \a page
index, \a location on the page, and \a zoom level; but \e not when simply
@@ -336,4 +336,4 @@ bool QPdfNavigationStack::forwardAvailable() const
QT_END_NAMESPACE
-#include "moc_qpdfnavigationstack.cpp"
+#include "moc_qpdfpagenavigator.cpp"
diff --git a/src/pdf/qpdfnavigationstack.h b/src/pdf/qpdfpagenavigator.h
index 3d894d326..cab6e612c 100644
--- a/src/pdf/qpdfnavigationstack.h
+++ b/src/pdf/qpdfpagenavigator.h
@@ -37,17 +37,17 @@
**
****************************************************************************/
-#ifndef QPDFNAVIGATIONSTACK_H
-#define QPDFNAVIGATIONSTACK_H
+#ifndef QPDFPAGENAVIGATOR_H
+#define QPDFPAGENAVIGATOR_H
#include <QtPdf/qtpdfglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
-struct QPdfNavigationStackPrivate;
+struct QPdfPageNavigatorPrivate;
-class Q_PDF_EXPORT QPdfNavigationStack : public QObject
+class Q_PDF_EXPORT QPdfPageNavigator : public QObject
{
Q_OBJECT
@@ -58,9 +58,9 @@ class Q_PDF_EXPORT QPdfNavigationStack : public QObject
Q_PROPERTY(bool forwardAvailable READ forwardAvailable NOTIFY forwardAvailableChanged)
public:
- QPdfNavigationStack() : QPdfNavigationStack(nullptr) {}
- explicit QPdfNavigationStack(QObject *parent);
- ~QPdfNavigationStack() override;
+ QPdfPageNavigator() : QPdfPageNavigator(nullptr) {}
+ explicit QPdfPageNavigator(QObject *parent);
+ ~QPdfPageNavigator() override;
int currentPage() const;
QPointF currentLocation() const;
@@ -85,9 +85,9 @@ Q_SIGNALS:
void jumped(int page, const QPointF &location, qreal zoom);
private:
- QScopedPointer<QPdfNavigationStackPrivate> d;
+ QScopedPointer<QPdfPageNavigatorPrivate> d;
};
QT_END_NAMESPACE
-#endif // QPDFNAVIGATIONSTACK_H
+#endif // QPDFPAGENAVIGATOR_H
diff --git a/src/pdfquick/CMakeLists.txt b/src/pdfquick/CMakeLists.txt
index b29f57aeb..bb712be7b 100644
--- a/src/pdfquick/CMakeLists.txt
+++ b/src/pdfquick/CMakeLists.txt
@@ -19,7 +19,7 @@ qt_internal_add_qml_module(PdfQuick
qquickpdfbookmarkmodel.cpp qquickpdfbookmarkmodel_p.h
qquickpdfdocument.cpp qquickpdfdocument_p.h
qquickpdflinkmodel.cpp qquickpdflinkmodel_p.h
- qquickpdfnavigationstack.cpp qquickpdfnavigationstack_p.h
+ qquickpdfpagenavigator.cpp qquickpdfpagenavigator_p.h
qquickpdfpageimage.cpp qquickpdfpageimage_p.h
qquickpdfsearchmodel.cpp qquickpdfsearchmodel_p.h
qquickpdfselection.cpp qquickpdfselection_p.h
diff --git a/src/pdfquick/PdfMultiPageView.qml b/src/pdfquick/PdfMultiPageView.qml
index 2457c5010..d7831f6bd 100644
--- a/src/pdfquick/PdfMultiPageView.qml
+++ b/src/pdfquick/PdfMultiPageView.qml
@@ -125,9 +125,9 @@ Item {
\c onCurrentPageChanged script) to update the part of the user interface
that shows the current page number, such as a \l SpinBox.
- \sa PdfNavigationStack::currentPage
+ \sa PdfPageNavigator::currentPage
*/
- property alias currentPage: navigationStack.currentPage
+ property alias currentPage: pageNavigator.currentPage
/*!
\qmlproperty bool PdfMultiPageView::backEnabled
@@ -136,9 +136,9 @@ Item {
This property indicates if it is possible to go back in the navigation
history to a previous-viewed page.
- \sa PdfNavigationStack::backAvailable, back()
+ \sa PdfPageNavigator::backAvailable, back()
*/
- property alias backEnabled: navigationStack.backAvailable
+ property alias backEnabled: pageNavigator.backAvailable
/*!
\qmlproperty bool PdfMultiPageView::forwardEnabled
@@ -147,9 +147,9 @@ Item {
This property indicates if it is possible to go to next location in the
navigation history.
- \sa PdfNavigationStack::forwardAvailable, forward()
+ \sa PdfPageNavigator::forwardAvailable, forward()
*/
- property alias forwardEnabled: navigationStack.forwardAvailable
+ property alias forwardEnabled: pageNavigator.forwardAvailable
/*!
\qmlmethod void PdfMultiPageView::back()
@@ -158,9 +158,9 @@ Item {
recently; or does nothing if there is no previous location on the
navigation stack.
- \sa PdfNavigationStack::back(), currentPage, backEnabled
+ \sa PdfPageNavigator::back(), currentPage, backEnabled
*/
- function back() { navigationStack.back() }
+ function back() { pageNavigator.back() }
/*!
\qmlmethod void PdfMultiPageView::forward()
@@ -169,19 +169,19 @@ Item {
method was called; or does nothing if there is no "next" location on the
navigation stack.
- \sa PdfNavigationStack::forward(), currentPage
+ \sa PdfPageNavigator::forward(), currentPage
*/
- function forward() { navigationStack.forward() }
+ function forward() { pageNavigator.forward() }
/*!
\qmlmethod void PdfMultiPageView::goToPage(int page)
Scrolls the view to the given \a page number, if possible.
- \sa PdfNavigationStack::jump(), currentPage
+ \sa PdfPageNavigator::jump(), currentPage
*/
function goToPage(page) {
- if (page === navigationStack.currentPage)
+ if (page === pageNavigator.currentPage)
return
goToLocation(page, Qt.point(-1, -1), 0)
}
@@ -192,15 +192,15 @@ Item {
Scrolls the view to the \a location on the \a page, if possible,
and sets the \a zoom level.
- \sa PdfNavigationStack::jump(), currentPage
+ \sa PdfPageNavigator::jump(), currentPage
*/
function goToLocation(page, location, zoom) {
if (zoom > 0) {
- navigationStack.jumping = true // don't call navigationStack.update() because we will jump() instead
+ pageNavigator.jumping = true // don't call pageNavigator.update() because we will jump() instead
root.renderScale = zoom
- navigationStack.jumping = false
+ pageNavigator.jumping = false
}
- navigationStack.jump(page, location, zoom) // actually jump
+ pageNavigator.jump(page, location, zoom) // actually jump
}
/*!
@@ -391,7 +391,7 @@ Item {
searchHighlights.update()
}
onStatusChanged: {
- if (index === navigationStack.currentPage)
+ if (index === pageNavigator.currentPage)
root.currentPageRenderingStatus = status
}
}
@@ -575,7 +575,7 @@ Item {
? Qt.point((tableView.contentX - currentItem.x + tableView.jumpLocationMargin.x) / root.renderScale,
(tableView.contentY - currentItem.y + tableView.jumpLocationMargin.y) / root.renderScale)
: Qt.point(0, 0) // maybe the delegate wasn't loaded yet
- navigationStack.jump(cell.y, currentLocation, root.renderScale)
+ pageNavigator.jump(cell.y, currentLocation, root.renderScale)
}
onActiveChanged: if (!active ) {
// When the scrollbar stops moving, tell navstack where we are, so as to update currentPage etc.
@@ -585,15 +585,15 @@ Item {
? Qt.point((tableView.contentX - currentItem.x + tableView.jumpLocationMargin.x) / root.renderScale,
(tableView.contentY - currentItem.y + tableView.jumpLocationMargin.y) / root.renderScale)
: Qt.point(0, 0) // maybe the delegate wasn't loaded yet
- navigationStack.update(cell.y, currentLocation, root.renderScale)
+ pageNavigator.update(cell.y, currentLocation, root.renderScale)
}
}
ScrollBar.horizontal: ScrollBar { }
}
onRenderScaleChanged: {
- // if navigationStack.jumped changes the scale, don't turn around and update the stack again;
+ // if pageNavigator.jumped changes the scale, don't turn around and update the stack again;
// and don't force layout either, because positionViewAtCell() will do that
- if (navigationStack.jumping)
+ if (pageNavigator.jumping)
return
// make TableView rebuild from scratch, because otherwise it doesn't know the delegates are changing size
tableView.rebuild()
@@ -602,11 +602,11 @@ Item {
if (currentItem) {
const currentLocation = Qt.point((tableView.contentX - currentItem.x + tableView.jumpLocationMargin.x) / root.renderScale,
(tableView.contentY - currentItem.y + tableView.jumpLocationMargin.y) / root.renderScale)
- navigationStack.update(cell.y, currentLocation, renderScale)
+ pageNavigator.update(cell.y, currentLocation, renderScale)
}
}
- PdfNavigationStack {
- id: navigationStack
+ PdfPageNavigator {
+ id: pageNavigator
property bool jumping: false
property int previousPage: 0
onJumped: function(page, location, zoom) {
@@ -642,7 +642,7 @@ Item {
property url documentSource: root.document.source
onDocumentSourceChanged: {
- navigationStack.clear()
+ pageNavigator.clear()
root.resetScale()
tableView.contentX = 0
tableView.contentY = 0
diff --git a/src/pdfquick/PdfPageView.qml b/src/pdfquick/PdfPageView.qml
index eac4fb520..ff4de9b81 100644
--- a/src/pdfquick/PdfPageView.qml
+++ b/src/pdfquick/PdfPageView.qml
@@ -124,9 +124,9 @@ Rectangle {
\c onCurrentPageChanged script) to update the part of the user interface
that shows the current page number, such as a \l SpinBox.
- \sa PdfNavigationStack::currentPage
+ \sa PdfPageNavigator::currentPage
*/
- property alias currentPage: navigationStack.currentPage
+ property alias currentPage: pageNavigator.currentPage
/*!
\qmlproperty bool PdfPageView::backEnabled
@@ -135,9 +135,9 @@ Rectangle {
This property indicates if it is possible to go back in the navigation
history to a previous-viewed page.
- \sa PdfNavigationStack::backAvailable, back()
+ \sa PdfPageNavigator::backAvailable, back()
*/
- property alias backEnabled: navigationStack.backAvailable
+ property alias backEnabled: pageNavigator.backAvailable
/*!
\qmlproperty bool PdfPageView::forwardEnabled
@@ -146,9 +146,9 @@ Rectangle {
This property indicates if it is possible to go to next location in the
navigation history.
- \sa PdfNavigationStack::forwardAvailable, forward()
+ \sa PdfPageNavigator::forwardAvailable, forward()
*/
- property alias forwardEnabled: navigationStack.forwardAvailable
+ property alias forwardEnabled: pageNavigator.forwardAvailable
/*!
\qmlmethod void PdfPageView::back()
@@ -157,9 +157,9 @@ Rectangle {
recently; or does nothing if there is no previous location on the
navigation stack.
- \sa PdfNavigationStack::back(), currentPage, backEnabled
+ \sa PdfPageNavigator::back(), currentPage, backEnabled
*/
- function back() { navigationStack.back() }
+ function back() { pageNavigator.back() }
/*!
\qmlmethod void PdfPageView::forward()
@@ -168,16 +168,16 @@ Rectangle {
method was called; or does nothing if there is no "next" location on the
navigation stack.
- \sa PdfNavigationStack::forward(), currentPage
+ \sa PdfPageNavigator::forward(), currentPage
*/
- function forward() { navigationStack.forward() }
+ function forward() { pageNavigator.forward() }
/*!
\qmlmethod void PdfPageView::goToPage(int page)
Changes the view to the \a page, if possible.
- \sa PdfNavigationStack::jump(), currentPage
+ \sa PdfPageNavigator::jump(), currentPage
*/
function goToPage(page) { goToLocation(page, Qt.point(0, 0), 0) }
@@ -187,12 +187,12 @@ Rectangle {
Scrolls the view to the \a location on the \a page, if possible,
and sets the \a zoom level.
- \sa PdfNavigationStack::jump(), currentPage
+ \sa PdfPageNavigator::jump(), currentPage
*/
function goToLocation(page, location, zoom) {
if (zoom > 0)
root.renderScale = zoom
- navigationStack.jump(page, location, zoom)
+ pageNavigator.jump(page, location, zoom)
}
// --------------------------------
@@ -266,7 +266,7 @@ Rectangle {
function scaleToPage(width, height) {
const windowAspect = width / height
const halfRotation = Math.abs(root.rotation % 180)
- const pagePointSize = document.pagePointSize(navigationStack.currentPage)
+ const pagePointSize = document.pagePointSize(pageNavigator.currentPage)
const pageAspect = pagePointSize.height / pagePointSize.width
if (halfRotation > 45 && halfRotation < 135) {
// rotated 90 or 270º
@@ -339,7 +339,7 @@ Rectangle {
PdfSelection {
id: selection
document: root.document
- page: navigationStack.currentPage
+ page: pageNavigator.currentPage
fromPoint: Qt.point(textSelectionDrag.centroid.pressPosition.x / image.pageScale, textSelectionDrag.centroid.pressPosition.y / image.pageScale)
toPoint: Qt.point(textSelectionDrag.centroid.position.x / image.pageScale, textSelectionDrag.centroid.position.y / image.pageScale)
hold: !textSelectionDrag.active && !tapHandler.pressed
@@ -351,14 +351,14 @@ Rectangle {
onCurrentPageChanged: root.goToPage(currentPage)
}
- PdfNavigationStack {
- id: navigationStack
+ PdfPageNavigator {
+ id: pageNavigator
onCurrentPageChanged: searchModel.currentPage = currentPage
onCurrentZoomChanged: root.renderScale = currentZoom
property url documentSource: root.document.source
onDocumentSourceChanged: {
- navigationStack.clear()
+ pageNavigator.clear()
root.goToPage(0)
}
}
@@ -366,13 +366,13 @@ Rectangle {
PdfPageImage {
id: image
document: root.document
- currentPage: navigationStack.currentPage
+ currentPage: pageNavigator.currentPage
asynchronous: true
fillMode: Image.PreserveAspectFit
property bool centerOnLoad: false
property bool vCenterOnLoad: false
property size centerInSize
- property real pageScale: image.paintedWidth / document.pagePointSize(navigationStack.currentPage).width
+ property real pageScale: image.paintedWidth / document.pagePointSize(pageNavigator.currentPage).width
function reRenderIfNecessary() {
const newSourceWidth = image.sourceSize.width * root.scale * Screen.devicePixelRatio
const ratio = newSourceWidth / image.sourceSize.width
@@ -391,7 +391,7 @@ Rectangle {
}
}
onRenderScaleChanged: {
- image.sourceSize.width = document.pagePointSize(navigationStack.currentPage).width * renderScale
+ image.sourceSize.width = document.pagePointSize(pageNavigator.currentPage).width * renderScale
image.sourceSize.height = 0
root.scale = 1
}
@@ -431,7 +431,7 @@ Rectangle {
model: PdfLinkModel {
id: linkModel
document: root.document
- page: navigationStack.currentPage
+ page: pageNavigator.currentPage
}
delegate: Item {
x: rect.x * image.pageScale
@@ -442,7 +442,7 @@ Rectangle {
TapHandler {
onTapped: {
if (page >= 0)
- navigationStack.jump(page, Qt.point(0, 0), root.renderScale)
+ pageNavigator.jump(page, Qt.point(0, 0), root.renderScale)
else
Qt.openUrlExternally(url)
}
diff --git a/src/pdfquick/PdfScrollablePageView.qml b/src/pdfquick/PdfScrollablePageView.qml
index 6b03c1c1c..6ee42d3ad 100644
--- a/src/pdfquick/PdfScrollablePageView.qml
+++ b/src/pdfquick/PdfScrollablePageView.qml
@@ -126,9 +126,9 @@ Flickable {
\c onCurrentPageChanged script) to update the part of the user interface
that shows the current page number, such as a \l SpinBox.
- \sa PdfNavigationStack::currentPage
+ \sa PdfPageNavigator::currentPage
*/
- property alias currentPage: navigationStack.currentPage
+ property alias currentPage: pageNavigator.currentPage
/*!
\qmlproperty bool PdfScrollablePageView::backEnabled
@@ -137,9 +137,9 @@ Flickable {
This property indicates if it is possible to go back in the navigation
history to a previous-viewed page.
- \sa PdfNavigationStack::backAvailable, back()
+ \sa PdfPageNavigator::backAvailable, back()
*/
- property alias backEnabled: navigationStack.backAvailable
+ property alias backEnabled: pageNavigator.backAvailable
/*!
\qmlproperty bool PdfScrollablePageView::forwardEnabled
@@ -148,9 +148,9 @@ Flickable {
This property indicates if it is possible to go to next location in the
navigation history.
- \sa PdfNavigationStack::forwardAvailable, forward()
+ \sa PdfPageNavigator::forwardAvailable, forward()
*/
- property alias forwardEnabled: navigationStack.forwardAvailable
+ property alias forwardEnabled: pageNavigator.forwardAvailable
/*!
\qmlmethod void PdfScrollablePageView::back()
@@ -159,9 +159,9 @@ Flickable {
recently; or does nothing if there is no previous location on the
navigation stack.
- \sa PdfNavigationStack::back(), currentPage, backEnabled
+ \sa PdfPageNavigator::back(), currentPage, backEnabled
*/
- function back() { navigationStack.back() }
+ function back() { pageNavigator.back() }
/*!
\qmlmethod void PdfScrollablePageView::forward()
@@ -170,19 +170,19 @@ Flickable {
method was called; or does nothing if there is no "next" location on the
navigation stack.
- \sa PdfNavigationStack::forward(), currentPage
+ \sa PdfPageNavigator::forward(), currentPage
*/
- function forward() { navigationStack.forward() }
+ function forward() { pageNavigator.forward() }
/*!
\qmlmethod void PdfScrollablePageView::goToPage(int page)
Changes the view to the \a page, if possible.
- \sa PdfNavigationStack::jump(), currentPage
+ \sa PdfPageNavigator::jump(), currentPage
*/
function goToPage(page) {
- if (page === navigationStack.currentPage)
+ if (page === pageNavigator.currentPage)
return
goToLocation(page, Qt.point(0, 0), 0)
}
@@ -193,12 +193,12 @@ Flickable {
Scrolls the view to the \a location on the \a page, if possible,
and sets the \a zoom level.
- \sa PdfNavigationStack::jump(), currentPage
+ \sa PdfPageNavigator::jump(), currentPage
*/
function goToLocation(page, location, zoom) {
if (zoom > 0)
root.renderScale = zoom
- navigationStack.jump(page, location, zoom)
+ pageNavigator.jump(page, location, zoom)
}
// --------------------------------
@@ -254,7 +254,7 @@ Flickable {
degrees, it will be scaled so that its width fits \a height.
*/
function scaleToWidth(width, height) {
- const pagePointSize = document.pagePointSize(navigationStack.currentPage)
+ const pagePointSize = document.pagePointSize(pageNavigator.currentPage)
root.renderScale = root.width / (paper.rot90 ? pagePointSize.height : pagePointSize.width)
console.log(lcSPV, "scaling", pagePointSize, "to fit", root.width, "rotated?", paper.rot90, "scale", root.renderScale)
root.contentX = 0
@@ -270,7 +270,7 @@ Flickable {
it is first rotated to have a matching aspect ratio.
*/
function scaleToPage(width, height) {
- const pagePointSize = document.pagePointSize(navigationStack.currentPage)
+ const pagePointSize = document.pagePointSize(pageNavigator.currentPage)
root.renderScale = Math.min(
root.width / (paper.rot90 ? pagePointSize.height : pagePointSize.width),
root.height / (paper.rot90 ? pagePointSize.width : pagePointSize.height) )
@@ -331,7 +331,7 @@ Flickable {
if (!active ) {
const currentLocation = Qt.point((root.contentX + root.width / 2) / root.renderScale,
(root.contentY + root.height / 2) / root.renderScale)
- navigationStack.update(navigationStack.currentPage, currentLocation, root.renderScale)
+ pageNavigator.update(pageNavigator.currentPage, currentLocation, root.renderScale)
}
}
ScrollBar.horizontal: ScrollBar {
@@ -339,18 +339,18 @@ Flickable {
if (!active ) {
const currentLocation = Qt.point((root.contentX + root.width / 2) / root.renderScale,
(root.contentY + root.height / 2) / root.renderScale)
- navigationStack.update(navigationStack.currentPage, currentLocation, root.renderScale)
+ pageNavigator.update(pageNavigator.currentPage, currentLocation, root.renderScale)
}
}
onRenderScaleChanged: {
- image.sourceSize.width = document.pagePointSize(navigationStack.currentPage).width *
+ image.sourceSize.width = document.pagePointSize(pageNavigator.currentPage).width *
renderScale * Screen.devicePixelRatio
image.sourceSize.height = 0
paper.scale = 1
const currentLocation = Qt.point((root.contentX + root.width / 2) / root.renderScale,
(root.contentY + root.height / 2) / root.renderScale)
- navigationStack.update(navigationStack.currentPage, currentLocation, root.renderScale)
+ pageNavigator.update(pageNavigator.currentPage, currentLocation, root.renderScale)
}
PdfSearchModel {
@@ -361,8 +361,8 @@ Flickable {
Qt.point(currentResultBoundingRect.x, currentResultBoundingRect.y), 0)
}
- PdfNavigationStack {
- id: navigationStack
+ PdfPageNavigator {
+ id: pageNavigator
onJumped: function(page, location, zoom) {
root.renderScale = zoom
const dx = Math.max(0, location.x * root.renderScale - root.width / 2) - root.contentX
@@ -379,7 +379,7 @@ Flickable {
property url documentSource: root.document.source
onDocumentSourceChanged: {
- navigationStack.clear()
+ pageNavigator.clear()
root.resetScale()
root.contentX = 0
root.contentY = 0
@@ -401,12 +401,12 @@ Flickable {
PdfPageImage {
id: image
document: root.document
- currentPage: navigationStack.currentPage
+ currentPage: pageNavigator.currentPage
asynchronous: true
fillMode: Image.PreserveAspectFit
rotation: root.pageRotation
anchors.centerIn: parent
- property real pageScale: image.paintedWidth / document.pagePointSize(navigationStack.currentPage).width
+ property real pageScale: image.paintedWidth / document.pagePointSize(pageNavigator.currentPage).width
Shape {
anchors.fill: parent
@@ -441,7 +441,7 @@ Flickable {
model: PdfLinkModel {
id: linkModel
document: root.document
- page: navigationStack.currentPage
+ page: pageNavigator.currentPage
}
delegate: Shape {
required property rect rect
@@ -469,7 +469,7 @@ Flickable {
TapHandler {
onTapped: {
if (page >= 0)
- navigationStack.jump(page, Qt.point(0, 0), root.renderScale)
+ pageNavigator.jump(page, Qt.point(0, 0), root.renderScale)
else
Qt.openUrlExternally(url)
}
@@ -507,7 +507,7 @@ Flickable {
id: selection
anchors.fill: parent
document: root.document
- page: navigationStack.currentPage
+ page: pageNavigator.currentPage
renderScale: image.pageScale == 0 ? 1.0 : image.pageScale
fromPoint: textSelectionDrag.centroid.pressPosition
toPoint: textSelectionDrag.centroid.position
@@ -539,7 +539,7 @@ Flickable {
paper.y = 0
root.contentX = centroidOnPage.x - centroidInFlickable.x
root.contentY = centroidOnPage.y - centroidInFlickable.y
- root.renderScale *= ratio // onRenderScaleChanged calls navigationStack.update() so we don't need to here
+ root.renderScale *= ratio // onRenderScaleChanged calls pageNavigator.update() so we don't need to here
console.log(lcSPV, "contentX/Y adjusted to", root.contentX.toFixed(2), root.contentY.toFixed(2))
} else {
paper.x = 0
diff --git a/src/pdfquick/qquickpdfnavigationstack.cpp b/src/pdfquick/qquickpdfpagenavigator.cpp
index c36e993d4..346b49b71 100644
--- a/src/pdfquick/qquickpdfnavigationstack.cpp
+++ b/src/pdfquick/qquickpdfpagenavigator.cpp
@@ -37,26 +37,26 @@
**
****************************************************************************/
-#include "qquickpdfnavigationstack_p.h"
+#include "qquickpdfpagenavigator_p.h"
#include <QLoggingCategory>
QT_BEGIN_NAMESPACE
-Q_LOGGING_CATEGORY(qLcNav, "qt.pdf.navigationstack")
+Q_LOGGING_CATEGORY(qLcNav, "qt.pdf.pagenavigator")
/*!
- \qmltype PdfNavigationStack
-//! \instantiates QQuickPdfNavigationStack
+ \qmltype PdfPageNavigator
+//! \instantiates QQuickPdfPageNavigator
\inqmlmodule QtQuick.Pdf
\ingroup pdf
\brief History of the destinations visited within a PDF Document.
\since 5.15
- PdfNavigationStack remembers which destinations the user has visited in a PDF
+ PdfPageNavigator remembers which destinations the user has visited in a PDF
document, and provides the ability to traverse backward and forward.
*/
-QQuickPdfNavigationStack::QQuickPdfNavigationStack(QObject *parent)
+QQuickPdfPageNavigator::QQuickPdfPageNavigator(QObject *parent)
: QObject(parent)
{
}
@@ -64,18 +64,18 @@ QQuickPdfNavigationStack::QQuickPdfNavigationStack(QObject *parent)
/*!
\internal
*/
-QQuickPdfNavigationStack::~QQuickPdfNavigationStack() = default;
+QQuickPdfPageNavigator::~QQuickPdfPageNavigator() = default;
/*!
\internal
*/
-QPdfNavigationStack *QQuickPdfNavigationStack::navStack()
+QPdfPageNavigator *QQuickPdfPageNavigator::navStack()
{
- return static_cast<QPdfNavigationStack *>(qmlExtendedObject(this));
+ return static_cast<QPdfPageNavigator *>(qmlExtendedObject(this));
}
/*!
- \qmlmethod void PdfNavigationStack::forward()
+ \qmlmethod void PdfPageNavigator::forward()
Goes back to the page, location and zoom level that was being viewed before
back() was called, and then emits the \l jumped() signal.
@@ -86,7 +86,7 @@ QPdfNavigationStack *QQuickPdfNavigationStack::navStack()
*/
/*!
- \qmlmethod void PdfNavigationStack::back()
+ \qmlmethod void PdfPageNavigator::back()
Pops the stack, updates the \l currentPage, \l currentLocation and
\l currentZoom properties to the most-recently-viewed destination, and then
@@ -94,26 +94,26 @@ QPdfNavigationStack *QQuickPdfNavigationStack::navStack()
*/
/*!
- \qmlproperty int PdfNavigationStack::currentPage
+ \qmlproperty int PdfPageNavigator::currentPage
This property holds the current page that is being viewed.
If there is no current page, it holds \c -1.
*/
/*!
- \qmlproperty point PdfNavigationStack::currentLocation
+ \qmlproperty point PdfPageNavigator::currentLocation
This property holds the current location on the page that is being viewed.
*/
/*!
- \qmlproperty real PdfNavigationStack::currentZoom
+ \qmlproperty real PdfPageNavigator::currentZoom
This property holds the magnification scale on the page that is being viewed.
*/
/*!
- \qmlmethod void PdfNavigationStack::jump(int page, point location, qreal zoom, bool emitJumped)
+ \qmlmethod void PdfPageNavigator::jump(int page, point location, qreal zoom, bool emitJumped)
Adds the given destination, consisting of \a page, \a location, and \a zoom,
to the history of visited locations. If \a emitJumped is \c false, the
@@ -125,7 +125,7 @@ QPdfNavigationStack *QQuickPdfNavigationStack::navStack()
*/
/*!
- \qmlmethod void PdfNavigationStack::update(int page, point location, qreal zoom)
+ \qmlmethod void PdfPageNavigator::update(int page, point location, qreal zoom)
Modifies the current destination, consisting of \a page, \a location and \a zoom.
@@ -141,21 +141,21 @@ QPdfNavigationStack *QQuickPdfNavigationStack::navStack()
*/
/*!
- \qmlproperty bool PdfNavigationStack::backAvailable
+ \qmlproperty bool PdfPageNavigator::backAvailable
\readonly
Holds \c true if a \e back destination is available in the history.
*/
/*!
- \qmlproperty bool PdfNavigationStack::forwardAvailable
+ \qmlproperty bool PdfPageNavigator::forwardAvailable
\readonly
Holds \c true if a \e forward destination is available in the history.
*/
/*!
- \qmlsignal PdfNavigationStack::jumped(int page, point location, qreal zoom)
+ \qmlsignal PdfPageNavigator::jumped(int page, point location, qreal zoom)
This signal is emitted when an abrupt jump occurs, to the specified \a page
index, \a location on the page, and \a zoom level; but \e not when simply
diff --git a/src/pdfquick/qquickpdfnavigationstack_p.h b/src/pdfquick/qquickpdfpagenavigator_p.h
index 8d5958259..b3c1c7ceb 100644
--- a/src/pdfquick/qquickpdfnavigationstack_p.h
+++ b/src/pdfquick/qquickpdfpagenavigator_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QQUICKPDFNAVIGATIONSTACK_P_H
-#define QQUICKPDFNAVIGATIONSTACK_P_H
+#ifndef QQUICKPDFPAGENAVIGATOR_P_H
+#define QQUICKPDFPAGENAVIGATOR_P_H
//
// W A R N I N G
@@ -52,32 +52,32 @@
//
#include <QtPdfQuick/private/qtpdfquickglobal_p.h>
-#include <QtPdf/qpdfnavigationstack.h>
+#include <QtPdf/qpdfpagenavigator.h>
#include <QtPdf/private/qpdflink_p.h>
#include <QQmlEngine>
QT_BEGIN_NAMESPACE
-class Q_PDFQUICK_EXPORT QQuickPdfNavigationStack : public QObject
+class Q_PDFQUICK_EXPORT QQuickPdfPageNavigator : public QObject
{
Q_OBJECT
- QML_EXTENDED(QPdfNavigationStack)
- QML_NAMED_ELEMENT(PdfNavigationStack)
+ QML_EXTENDED(QPdfPageNavigator)
+ QML_NAMED_ELEMENT(PdfPageNavigator)
QML_ADDED_IN_VERSION(5, 15)
public:
- explicit QQuickPdfNavigationStack(QObject *parent = nullptr);
- ~QQuickPdfNavigationStack() override;
+ explicit QQuickPdfPageNavigator(QObject *parent = nullptr);
+ ~QQuickPdfPageNavigator() override;
private:
- QPdfNavigationStack *navStack();
+ QPdfPageNavigator *navStack();
- Q_DISABLE_COPY(QQuickPdfNavigationStack)
+ Q_DISABLE_COPY(QQuickPdfPageNavigator)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QQuickPdfNavigationStack)
+QML_DECLARE_TYPE(QQuickPdfPageNavigator)
-#endif // QQUICKPDFNAVIGATIONSTACK_P_H
+#endif // QQUICKPDFPAGENAVIGATOR_P_H
diff --git a/src/pdfwidgets/qpdfview.cpp b/src/pdfwidgets/qpdfview.cpp
index bab70c773..ce4c42469 100644
--- a/src/pdfwidgets/qpdfview.cpp
+++ b/src/pdfwidgets/qpdfview.cpp
@@ -47,7 +47,7 @@
#include <QPainter>
#include <QPaintEvent>
#include <QPdfDocument>
-#include <QPdfNavigationStack>
+#include <QPdfPageNavigator>
#include <QScreen>
#include <QScrollBar>
#include <QScroller>
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
QPdfViewPrivate::QPdfViewPrivate(QPdfView *q)
: q_ptr(q)
, m_document(nullptr)
- , m_pageNavigation(nullptr)
+ , m_pageNavigator(nullptr)
, m_pageRenderer(nullptr)
, m_pageMode(QPdfView::PageMode::SinglePage)
, m_zoomMode(QPdfView::ZoomMode::Custom)
@@ -74,7 +74,7 @@ void QPdfViewPrivate::init()
{
Q_Q(QPdfView);
- m_pageNavigation = new QPdfNavigationStack(q);
+ m_pageNavigator = new QPdfPageNavigator(q);
m_pageRenderer = new QPdfPageRenderer(q);
m_pageRenderer->setRenderMode(QPdfPageRenderer::RenderMode::MultiThreaded);
}
@@ -130,7 +130,7 @@ void QPdfViewPrivate::setViewport(QRect viewport)
if (m_pageMode == QPdfView::PageMode::MultiPage) {
// An imaginary, 2px height line at the upper half of the viewport, which is used to
// determine which page is currently located there -> we propagate that as 'current' page
- // to the QPdfNavigationStack object
+ // to the QPdfPageNavigator object
const QRect currentPageLine(m_viewport.x(), m_viewport.y() + m_viewport.height() * 0.4, m_viewport.width(), 2);
int currentPage = 0;
@@ -142,10 +142,10 @@ void QPdfViewPrivate::setViewport(QRect viewport)
}
}
- if (currentPage != m_pageNavigation->currentPage()) {
+ if (currentPage != m_pageNavigator->currentPage()) {
m_blockPageScrolling = true;
// ΤODO give location on the page
- m_pageNavigation->jump(currentPage, {}, m_zoomFactor);
+ m_pageNavigator->jump(currentPage, {}, m_zoomFactor);
m_blockPageScrolling = false;
}
}
@@ -216,8 +216,8 @@ QPdfViewPrivate::DocumentLayout QPdfViewPrivate::calculateDocumentLayout() const
int totalWidth = 0;
- const int startPage = (m_pageMode == QPdfView::PageMode::SinglePage ? m_pageNavigation->currentPage() : 0);
- const int endPage = (m_pageMode == QPdfView::PageMode::SinglePage ? m_pageNavigation->currentPage() + 1 : pageCount);
+ const int startPage = (m_pageMode == QPdfView::PageMode::SinglePage ? m_pageNavigator->currentPage() : 0);
+ const int endPage = (m_pageMode == QPdfView::PageMode::SinglePage ? m_pageNavigator->currentPage() + 1 : pageCount);
// calculate page sizes
for (int page = startPage; page < endPage; ++page) {
@@ -307,7 +307,7 @@ QPdfView::QPdfView(QWidget *parent)
d->init();
- connect(d->m_pageNavigation, &QPdfNavigationStack::currentPageChanged, this,
+ connect(d->m_pageNavigator, &QPdfPageNavigator::currentPageChanged, this,
[d](int page){ d->currentPageChanged(page); });
connect(d->m_pageRenderer, &QPdfPageRenderer::pageRendered, this,
@@ -367,11 +367,11 @@ QPdfDocument *QPdfView::document() const
/*!
This accessor returns the navigation stack that will handle back/forward navigation.
*/
-QPdfNavigationStack *QPdfView::pageNavigation() const
+QPdfPageNavigator *QPdfView::pageNavigator() const
{
Q_D(const QPdfView);
- return d->m_pageNavigation;
+ return d->m_pageNavigator;
}
/*!
diff --git a/src/pdfwidgets/qpdfview.h b/src/pdfwidgets/qpdfview.h
index 7571aec9a..899113294 100644
--- a/src/pdfwidgets/qpdfview.h
+++ b/src/pdfwidgets/qpdfview.h
@@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE
class QPdfDocument;
-class QPdfNavigationStack;
+class QPdfPageNavigator;
class QPdfViewPrivate;
class Q_PDF_WIDGETS_EXPORT QPdfView : public QAbstractScrollArea
@@ -85,7 +85,7 @@ public:
void setDocument(QPdfDocument *document);
QPdfDocument *document() const;
- QPdfNavigationStack *pageNavigation() const;
+ QPdfPageNavigator *pageNavigator() const;
PageMode pageMode() const;
ZoomMode zoomMode() const;
diff --git a/src/pdfwidgets/qpdfview_p.h b/src/pdfwidgets/qpdfview_p.h
index 4e6a68581..91198e2d3 100644
--- a/src/pdfwidgets/qpdfview_p.h
+++ b/src/pdfwidgets/qpdfview_p.h
@@ -91,7 +91,7 @@ public:
QPdfView *q_ptr;
QPointer<QPdfDocument> m_document;
- QPdfNavigationStack* m_pageNavigation;
+ QPdfPageNavigator* m_pageNavigator;
QPdfPageRenderer *m_pageRenderer;
QPdfView::PageMode m_pageMode;
diff --git a/tests/auto/pdf/CMakeLists.txt b/tests/auto/pdf/CMakeLists.txt
index c35d8055b..e2ba73c6e 100644
--- a/tests/auto/pdf/CMakeLists.txt
+++ b/tests/auto/pdf/CMakeLists.txt
@@ -1,5 +1,5 @@
add_subdirectory(qpdfbookmarkmodel)
-#add_subdirectory(qpdfpagenavigation)
+#add_subdirectory(qpdfpagenavigator)
add_subdirectory(qpdfpagerenderer)
if(TARGET Qt::PrintSupport)
add_subdirectory(qpdfdocument)