Navigation history within a PDF document. More…
Synopsis¶
Properties¶
Methods¶
def
__init__()
def
backAvailable()
def
currentLink()
def
currentPage()
def
currentZoom()
Slots¶
Signals¶
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
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.See also
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.Holds
true
if a back destination is available in the history: that is, if push() orforward()
has been called.- Access functions:
This property holds the current location on the page that is being viewed (the location that was last given to
jump()
orupdate()
). The default is0, 0
.- Access functions:
This property holds the current page that is being viewed. The default is
0
.- Access functions:
This property holds the magnification scale (1 logical pixel = 1 point) on the page that is being viewed. The default is
1
.- Access functions:
Holds
true
if a forward destination is available in the history: that is, ifback()
has been previously called.- Access functions:
- __init__(parent)
- Parameters:
parent –
QObject
Constructs a page navigation stack with parent object
parent
.Pops the stack, updates the
currentPage
,currentLocation
andcurrentZoom
properties to the most-recently-viewed destination, and then emits thejumped()
signal.- backAvailable()¶
- Return type:
bool
Getter of property
backAvailableᅟ
.- Parameters:
available – bool
Notification signal of property
backAvailableᅟ
.Clear the history and restore
currentPage
,currentLocation
andcurrentZoom
to their default values.- Return type:
Getter of property
currentLocationᅟ
.- Parameters:
location –
QPointF
Notification signal of property
currentLocationᅟ
.- currentPage()¶
- Return type:
int
Getter of property
currentPageᅟ
.- Parameters:
page – int
Notification signal of property
currentPageᅟ
.- currentZoom()¶
- Return type:
float
Getter of property
currentZoomᅟ
.- Parameters:
zoom – float
Notification signal of property
currentZoomᅟ
.Goes back to the page, location and zoom level that was being viewed before
back()
was called, and then emits thejumped()
signal.If a new destination was pushed since the last time
back()
was called, the forward() function does nothing, because there is a branch in the timeline which causes the “future” to be lost.- forwardAvailable()¶
- Return type:
bool
Getter of property
forwardAvailableᅟ
.- Parameters:
available – bool
Notification signal of property
forwardAvailableᅟ
.- Parameters:
destination –
QPdfLink
Adds the given
destination
to the history of visited locations.In this case, PDF views respond to the
jumped
signal by scrolling to placedestination.rectangles
in the viewport, as opposed to placingdestination.location
in the viewport. So it’s appropriate to call this method to jump to a search result fromQPdfSearchModel
(because the rectangles cover the region of text found). To jump to a hyperlink destination, call jump(page, location, zoom) instead, because in that case theQPdfLink
object’srectangles
cover the hyperlink origin location rather than the destination.- jump(page, location[, zoom=0])
- Parameters:
page – int
location –
QPointF
zoom – float
Adds the given destination, consisting of
page
,location
, andzoom
, to the history of visited locations.The
zoom
argument represents magnification (where1
is the default scale, 1 logical pixel = 1 point). Ifzoom
is not given or is0
,currentZoom
keeps its existing value, andcurrentZoomChanged
is not emitted.The
location
should be the same aslocation()
if the user is following a link; and since that is specified as the upper-left corner of the destination, it is best for consistency to always use the location visible in the upper-left corner of the viewport, in points.If
forwardAvailable
istrue
, calling this function represents a branch in the timeline which causes the “future” to be lost, and thereforeforwardAvailable
will change tofalse
.- Parameters:
current –
QPdfLink
This signal is emitted when an abrupt jump occurs, to the
current
page index, location on the page, and zoom level; but not when simply scrolling through the document one page at a time. That is,jump()
,forward()
andback()
emit this signal, butupdate()
does not.If
current.rectangles.length > 0
, they are rectangles that cover a specific destination area: a search result that should be made visible; otherwise,current.location
is the destination location on thepage
(a hyperlink destination, or during forward/back navigation).- Parameters:
page – int
location –
QPointF
zoom – float
Modifies the current destination, consisting of
page
,location
andzoom
.This can be called periodically while the user is manually moving around the document, so that after
back()
is called,forward()
will jump back to the most-recently-viewed destination rather than the destination that was last specified by push().The
currentZoomChanged
,currentPageChanged
andcurrentLocationChanged
signals will be emitted if the respective properties are actually changed. Thejumped
signal is not emitted, because this operation represents smooth movement rather than a navigational jump.