Class: QgsLayoutView¶
A graphical widget to display and interact with QgsLayouts.
QgsLayoutView manages the layout interaction tools and
mouse/key events.
QgsLayoutView¶
Class Hierarchy¶
Base classes¶
- class qgis.gui.QgsLayoutView[source]¶
Bases:
QGraphicsView- __init__(parent: QWidget | None = None)
Constructor for QgsLayoutView.
- Parameters:
parent (Optional[QWidget] = None)
- ClipboardCopy = 1¶
- ClipboardCut = 0¶
- class ClipboardOperation¶
Bases:
int
- class PasteMode¶
Bases:
int
- PasteModeCenter = 1¶
- PasteModeCursor = 0¶
- PasteModeInPlace = 2¶
- alignSelectedItems(self, alignment: QgsLayoutAligner.Alignment)[source]¶
Aligns all selected items using the specified
alignment.See also
See also
- Parameters:
alignment (QgsLayoutAligner.Alignment)
- copyItems(self, items: Iterable[QgsLayoutItem], operation: QgsLayoutView.ClipboardOperation)[source]¶
Cuts or copies the a list of
items, respecting the specifiedoperation.See also
See also
- Parameters:
items (Iterable[QgsLayoutItem])
operation (QgsLayoutView.ClipboardOperation)
- copySelectedItems(self, operation: QgsLayoutView.ClipboardOperation)[source]¶
Cuts or copies the selected items, respecting the specified
operation.See also
See also
- Parameters:
operation (QgsLayoutView.ClipboardOperation)
- currentLayout(self) QgsLayout | None[source]¶
Returns the current layout associated with the view.
See also
See also
- Return type:
Optional[QgsLayout]
- currentPage(self) int[source]¶
Returns the page visible in the view. This method considers the page at the center of the view as the current visible page.
See also
- Return type:
int
- signal cursorPosChanged[source]¶
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.
- deleteItems(self, items: Iterable[QgsLayoutItem])[source]¶
Delete the specified
items.See also
- Parameters:
items (Iterable[QgsLayoutItem])
- deltaForKeyEvent(self, event: QKeyEvent | None) QPointF[source]¶
Returns the delta (in layout coordinates) by which to move items for the given key
event.- Parameters:
event (Optional[QKeyEvent])
- Return type:
QPointF
- distributeSelectedItems(self, distribution: QgsLayoutAligner.Distribution)[source]¶
Distributes all selected items using the specified
distribution.See also
See also
- Parameters:
distribution (QgsLayoutAligner.Distribution)
- hasItemsInClipboard(self) bool[source]¶
Returns
Trueif the current clipboard contains layout items.See also
- Return type:
bool
- invertSelection(self)[source]¶
Inverts the current selection, selecting deselected items and deselecting and selected items.
See also
See also
- signal itemFocused[source]¶
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.
- signal layoutSet[source]¶
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.
- lockSelectedItems(self)[source]¶
Locks any selected items, preventing them from being interacted with by mouse interactions.
See also
- lowerSelectedItems(self)[source]¶
Lowers the selected items down the z-order.
See also
See also
See also
Returns the provider for context menus. Returned value may be
Noneif no provider is set.See also
- Return type:
Optional[QgsLayoutViewMenuProvider]
- moveSelectedItemsToBottom(self)[source]¶
Lowers the selected items to the bottom of the z-order.
See also
See also
See also
- moveSelectedItemsToTop(self)[source]¶
Raises the selected items to the top of the z-order.
See also
See also
See also
- signal pageChanged[source]¶
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.
- pasteItems(self, mode: QgsLayoutView.PasteMode) List[QgsLayoutItem]¶
Pastes items from clipboard, using the specified
mode.A list of pasted items is returned.
See also
See also
pasteItems(self, layoutPoint: Union[QPointF, QPoint]) -> List[QgsLayoutItem] Pastes items from clipboard, at the specified
layoutPoint, in layout units.A list of pasted items is returned.
See also
See also
- Parameters:
mode (QgsLayoutView.PasteMode)
- Return type:
- previewMode(self) QgsPreviewEffect.PreviewMode[source]¶
Returns the preview mode which may be used to modify the view’s appearance. Preview modes are only used if
previewModeEnabled()isTrue.See also
See also
- Return type:
- previewModeEnabled(self) bool[source]¶
Returns
Trueif a preview effect is being used to alter the view’s appearance.See also
- Return type:
bool
- pushStatusMessage(self, message: str | None)[source]¶
Pushes a new status bar
messageto the view. This causesstatusMessage()to be emitted, which should cause the message to appear in the status bar for the parent window.See also
- Parameters:
message (Optional[str])
- raiseSelectedItems(self)[source]¶
Raises the selected items up the z-order.
See also
See also
See also
- resizeSelectedItems(self, resize: QgsLayoutAligner.Resize)[source]¶
Resizes all selected items using the specified
resizemode.See also
See also
- Parameters:
resize (QgsLayoutAligner.Resize)
- scaleSafe(self, scale: float)[source]¶
Scales the view in a safe way, by limiting the acceptable range of the scale applied. The
scaleparameter specifies the zoom factor to scale the view by.- Parameters:
scale (float)
- selectNextItemAbove(self)[source]¶
Selects the next item above the existing selection, by item z order.
See also
See also
See also
- selectNextItemBelow(self)[source]¶
Selects the next item below the existing selection, by item z order.
See also
See also
See also
- setCurrentLayout(self, layout: QgsLayout | None)[source]¶
Sets the current
layoutto edit in the view.See also
See also
- Parameters:
layout (Optional[QgsLayout])
- setHorizontalRuler(self, ruler: QgsLayoutRuler | None)[source]¶
Sets a horizontal
rulerto synchronize with the view state.See also
- Parameters:
ruler (Optional[QgsLayoutRuler])
- setMenuProvider(self, provider: QgsLayoutViewMenuProvider | None)[source]¶
Sets a
providerfor context menus. Ownership of the provider is transferred to the view.See also
- Parameters:
provider (Optional[QgsLayoutViewMenuProvider])
- setPreviewMode(self, mode: QgsPreviewEffect.PreviewMode)[source]¶
Sets the preview
modewhich should be used to modify the view’s appearance. Preview modes are only used ifpreviewModeEnabled()isTrue.See also
See also
- Parameters:
mode (QgsPreviewEffect.PreviewMode)
- setPreviewModeEnabled(self, enabled: bool)[source]¶
Sets whether a preview effect should be used to alter the view’s appearance.
- Parameters:
enabled (bool) – Set to
Trueto enable the preview effect on the view.
See also
- setSectionLabel(self, label: str | None)[source]¶
Sets a section
label, to display above the first page shown in the view.- Parameters:
label (Optional[str])
- setTool(self, tool: QgsLayoutViewTool | None)[source]¶
Sets the
toolcurrently being used in the view.See also
See also
- Parameters:
tool (Optional[QgsLayoutViewTool])
- setVerticalRuler(self, ruler: QgsLayoutRuler | None)[source]¶
Sets a vertical
rulerto synchronize with the view state.See also
- Parameters:
ruler (Optional[QgsLayoutRuler])
- setZoomLevel(self, level: float)[source]¶
Sets the zoom
levelfor the view, where a zoom level of 1.0 corresponds to 100%.- Parameters:
level (float)
- signal statusMessage[source]¶
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.
- tool(self) QgsLayoutViewTool | None[source]¶
Returns the currently active tool for the view.
See also
- Return type:
Optional[QgsLayoutViewTool]
- signal toolSet[source]¶
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.
- unsetTool(self, tool: QgsLayoutViewTool | None)[source]¶
Unsets the current view tool, if it matches the specified
tool.This is called from destructor of view tools to make sure that the tool won’t be used any more. You don’t have to call it manually,
QgsLayoutViewTooltakes care of it.- Parameters:
tool (Optional[QgsLayoutViewTool])
- viewChanged(self)[source]¶
Updates associated rulers and other widgets after view extent or zoom has changed. This should be called after calling any of the QGraphicsView base class methods which alter the view’s zoom level or extent, i.e. QGraphicsView.fitInView().
- visiblePageNumbers(self) List[int]¶
Returns a list of page numbers for pages which are currently visible in the view.
See also
- Return type:
List[int]
- visiblePages(self) List[QgsLayoutItemPage]¶
Returns a list of page items which are currently visible in the view.
See also
- Return type:
- signal willBeDeleted[source]¶
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.
- signal zoomLevelChanged[source]¶
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.