The rubberband module¶
Rubberband selection in a View.
A Rubberband to select a rectangular region.
A Rubberband is added to a View with view.setRubberband().
The Rubberband lets the user select a rectangular region. When the selection is changed, the selectionChanged signal is emitted, having the selection rectangle in layout coordinates as argument.
the button used to drag a new rectangle
the button to alter an existing rectangle
whether to continuously emit selectionChanged(). When True,
selectionChanged()is emitted on every change, when False, the signal is only emitted when the mouse button is released.
Return the edge where the point touches our geometry.
Sets the cursor shape when we are at edge.
Return True when there is a selection.
Return our selection rectangle, relative to the view’s layout position.
Yield tuples (page, rect) describing the selection.
Every rect is intersected with the page rect and translated to the page’s position.
Returns (page, rect) if there is a selection.
If the selection contains more pages, the largest intersection is chosen. If no meaningful area is selected, (None, None) is returned.
Returns an image of the selected part on a Page.
If resolution is None, the displayed size is chosen. Otherwise, the resolution is an integer, interpreted as DPI (dots per inch).
Return the text found in the selection, as far as the pages support it.
Yield tuples (page, links) for every page in the selection.
links is a non-empty set() of Link instances on that page that intersect with the selection.
Sets the selection, the rectangle should be relative to the view’s layout position.
Hide ourselves and clear the selection.
Called by the View when scrolling.
Start dragging the rubberband.
Continue dragging the rubberband, scrolling the View if necessary.
Drag by diff (QPoint).
Stop dragging the rubberband.
Called when the zooming in the view changes, resizes ourselves.
Act on events in the viewport:
keep on the same place when the viewport resizes
start dragging the selection if showbutton clicked (preventing the contextmenu if the showbutton is the right button)
end a drag on mousebutton release, if that button would have shown the context menu, show it on button release.
Can start a new drag when we are clicked ourselves.
Move if we are dragging; show the correct cursor shape on the edges.
End a self-initiated drag; if the right button was used; send a context menu event.