The viewactions module¶
ViewActions provides QActions to control a View.
- class ViewActions(*args, **kwargs)[source]¶
Bases:
QObject
ViewActions provides QActions to control a View.
Use setView() to connect the actions with a View. If no View is connected, and an action is used; the viewRequested signal is emitted. You can connect this signal and call setView() in the called slot; the action is then performed on the View.
The attribute smartLayoutOrientationEnabled (defaulting to True) enables some intuitive behaviour: if set to True, for layout modes that do not make sense in horizontal mode the orientation is automatically set to Vertical; and when the user chooses Horizontal orientation in such modes, the layout mode is set to “single”.
- smartLayoutOrientationEnabled = True¶
- viewRequested¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- setView(view)[source]¶
Connects all the actions to the View.
Use None to set no view. If a view was previously set, all connections are removed from that View.
- view()[source]¶
Return the View.
If no View is set, viewRequested is emitted. You can connect to this signal to create a View, and call setView() to use it to perform the requested action.
- updateFromProperties(properties)[source]¶
Set the actions to the state stored in the given ViewProperties.
- class PagerAction(*args, **kwargs)[source]¶
Bases:
QWidgetAction
PagerAction shows a spinbox widget with the current page number.
When the current page number is changed (by the user or by calling setCurrentPageNumber()) the signal currentPageNumberChanged() is emitted with the new current page number.
You can use the instance or class attributes buttonSymbols, focusPolicy and the displayFormat() method to influence behaviour and appearance of the spinbox widget(s) that is/are created when this action is added to a toolbar.
The displayFormat string should contain the text “{num}”. You can also include the string “{total}”, so the page count is displayed as well.
- currentPageNumberChanged¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- buttonSymbols = 2¶
- focusPolicy = 2¶
- setButtonSymbols(buttonSymbols)[source]¶
Set the
buttonSymbols
property, and update already existing widgets.
- class ZoomerAction(*args, **kwargs)[source]¶
Bases:
QWidgetAction
ZoomerAction provides a combobox with view modes and zoom factors.
- zoomFactorChanged¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- viewModeChanged¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- viewModes()[source]¶
Return the view modes that are displayed in the combobox.
See setViewModes() for explanation.
- setViewModes(modes)[source]¶
Set the view modes to display on top of the zoom values in the box.
An iterable of tuples (mode, name) is expected; every mode is a viewMode, the name is displayed. By default modes 1, 2 and 3 are displayed with the names “Width”, “Height”, “Page”.
- zoomFactors()[source]¶
Return the zoom factors that are displayed in the combobox.
A zoom factor of 100% is represented by a floating point value of 1.0.