Logo

Widget to display page-based documents for Qt5/PyQt6

Navigation

Contents

  • Basic usage
  • Advanced usage
  • Interacting with pages
  • How rendering works
  • Overview of all modules
    • The main qpageview module
    • The backgroundjob module
    • The cache module
    • The constants module
    • The cupsprinter module
    • The diff module
    • The document module
    • The export module
    • The highlight module
    • The image module
    • The imageview module
    • The layout module
    • The link module
    • The locking module
    • The magnifier module
    • The multipage module
    • The page module
    • The pdf module
    • The pkginfo module
    • The printing module
    • The rectangles module
    • The render module
    • The rubberband module
    • The scrollarea module
    • The selector module
    • The shadow module
    • The sidebarview module
    • The svg module
    • The util module
    • The viewactions module
    • The view module
    • The widgetoverlay module

About

  • Installing qpageview
  • Changelog
  • License

  • qpageview@Github
  • qpageview@PyPi

Related Topics

  • Documentation overview
    • Overview of all modules
      • Previous: The layout module
      • Next: The locking module

Quick search

The link module¶

Generic Link class and handling of links (clickable areas on a Page).

The link area is in coordinates between 0.0 and 1.0, like Poppler does it. This way we can easily compute where the link area is on a page in different sizes or rotations.

class Area(left, top, right, bottom)¶

Bases: tuple

bottom¶

Alias for field number 3

left¶

Alias for field number 0

right¶

Alias for field number 2

top¶

Alias for field number 1

class Link(left, top, right, bottom, url=None, tooltip=None)[source]¶

Bases: object

fileName = ''¶
targetPage = -1¶
area = (0, 0, 0, 0)¶
url = ''¶
isExternal = False¶
tooltip = ''¶
rect()[source]¶

Return the area attribute as a QRectF().

class Links(objects=None)[source]¶

Bases: Rectangles

Manages a list of Link objects.

See the rectangles documentation for how to access the links.

get_coords(link)[source]¶

You should implement this method.

The result should be a four-tuple with the coordinates of the rectangle the object represents (x, y, x2, y2). These are requested only once. x should be < x2 and y should be < y2.

class LinkViewMixin(parent=None, **kwds)[source]¶

Bases: object

Mixin class to enhance view.View with link capabilities.

linkHovered¶

(page, link) emitted when the user hovers a link

linkLeft¶

(no args) emitted when the user does not hover a link anymore

linkClicked¶

(event, page, link) emitted when the user clicks a link

linkHelpRequested¶

(event, page, link) emitted when a What’s This or Toolip is requested. The event’s type determines the type of this help event.

linksEnabled = True¶

whether to actually enable Link handling

setLinkHighlighter(highlighter)[source]¶

Sets a Highlighter (see highlight.py) to highlight a link on hover.

Use None to remove an active Highlighter. By default no highlighter is set to highlight links on hover.

To be able to actually use highlighting, be sure to also mix in the HighlightViewMixin class from the highlight module.

linkHighlighter()[source]¶

Return the currently set Highlighter, if any.

By default no highlighter is set to highlight links on hover, and None is returned in that case.

adjustCursor(pos)[source]¶

Adjust the cursor if pos is on a link (and linksEnabled is True).

Also emits signals when the cursor enters or leaves a link.

linkAt(pos)[source]¶

If the pos (in the viewport) is over a link, return a (page, link) tuple.

Otherwise returns (None, None).

linkHoverEnter(page, link)[source]¶

Called when the mouse hovers over a link.

The default implementation emits the linkHovered(page, link) signal, sets a pointing hand mouse cursor, and, if a Highlighter was set using setLinkHighlighter(), highlights the link. You can reimplement this method to do something different.

linkHoverLeave()[source]¶

Called when the mouse does not hover a link anymore.

The default implementation emits the linkLeft() signal, sets a default mouse cursor, and, if a Highlighter was set using setLinkHighlighter(), removes the highlighting of the current link. You can reimplement this method to do something different.

linkClickEvent(ev, page, link)[source]¶

Called when a link is clicked.

The default implementation emits the linkClicked(event, page, link) signal. The event can be used for things like determining which button was used, and which keyboard modifiers were in effect.

linkHelpEvent(ev, page, link)[source]¶

Called when a ToolTip or WhatsThis wants to appear.

The default implementation emits the linkHelpRequested(event, page, link) signal. Using the event you can find the position, and the type of the help event.

event(ev)[source]¶

Reimplemented to handle HelpEvent for links.

mousePressEvent(ev)[source]¶

Implemented to detect clicking a link and calling linkClickEvent().

leaveEvent(ev)[source]¶

Implemented to leave a link, might there still be one hovered.

 
  • ← The layout module
  • The locking module →
©2020-2025, Wilbert Berendsen. | Powered by Sphinx 8.2.3 & Alabaster 0.7.16 | Page source