The selector module

SelectorViewMixin class, to mixin with View.

Adds the capability to select or unselect Pages.

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

Bases: object

SelectorViewMixin class, to mixin with View.

Adds the capability to select or unselect Pages. Pages are numbered from 1.

Instance variables:

userChangeSelectionModeEnabled = True

whether the user can change the selectionMode (by longpressing a page to enable selectionMode, and pressing ESC to leave selectionMode. (Be sure to mix in the qpageview.util.LongMousePressMixin class when you want to use the long mouse press event.)

selectionChanged
selectionModeChanged
userChangeSelectionModeEnabled = True
selection()[source]

Return the current list of selected page numbers.

modifySelection()[source]

Context manager that allows changing the selection.

Yields a set, and on exit of the context, stores the modifications and emits the selectionChanged() signal. Used internally by all other methods.

updatePageLayout(lazy=False)[source]

Reimplemented to also check the selection.

clearSelection()[source]

Convenience method to clear the selection.

selectAll()[source]

Convenience method to select all pages.

toggleSelection(pageNumber)[source]

Toggles the selected state of page number pageNumber.

selectionMode()[source]

Return the current selectionMode (True is enabled, False is disabled).

setSelectionMode(mode)[source]

Switch selection mode on or off (True is enabled, False is disabled).

paintEvent(ev)[source]
drawSelection(page, painter)[source]

Draws the state (selected or not) for the page.

mousePressEvent(ev)[source]

Reimplemented to check if a checkbox was clicked.

keyPressEvent(ev)[source]

Clear the selection and switch off selectionmode with ESC.

longMousePressEvent(ev)[source]

Called on long mouse button press, set selectionMode on if enabled.