Class: QgsLayoutView¶
- class qgis.gui.QgsLayoutView¶
Bases:
PyQt5.QtWidgets.QGraphicsView
A graphical widget to display and interact with
QgsLayouts
.QgsLayoutView
manages the layout interaction tools and mouse/key events.New in version 3.0.
QgsLayoutView(parent: QWidget = None) Constructor for QgsLayoutView.
Methods
Aligns all selected items using the specified
alignment
.Cuts or copies the a list of
items
, respecting the specifiedoperation
.Cuts or copies the selected items, respecting the specified
operation
.Returns the current layout associated with the view.
Returns the page visible in the view.
Delete the specified
items
.Deletes all selected items.
Returns the delta (in layout coordinates) by which to move items for the given key
event
.Deselects all items in the view.
Distributes all selected items using the specified
distribution
.- param e
Groups all selected items.
Returns
True
if the current clipboard contains layout items.Inverts the current selection, selecting deselected items and deselecting and selected items.
- param event
- param event
Locks any selected items, preventing them from being interacted with by mouse interactions.
Lowers the selected items down the z-order.
Returns the provider for context menus.
- param event
- param event
- param event
- param event
Lowers the selected items to the bottom of the z-order.
Raises the selected items to the top of the z-order.
- param event
Pastes items from clipboard, using the specified
mode
.Returns the preview mode which may be used to modify the view's appearance.
Returns
True
if a preview effect is being used to alter the view's appearance.Pushes a new status bar
message
to the view.Raises the selected items up the z-order.
- param event
Resizes all selected items using the specified
resize
mode.Scales the view in a safe way, by limiting the acceptable range of the scale applied.
- param dx
Selects all items in the view.
Selects the next item above the existing selection, by item z order.
Selects the next item below the existing selection, by item z order.
Sets the current
layout
to edit in the view.Sets a horizontal
ruler
to synchronize with the view state.Sets a
provider
for context menus.Sets the preview
mode
which should be used to modify the view's appearance.Sets whether a preview effect should be used to alter the view's appearance.
Sets a section
label
, to display above the first page shown in the view.Sets the
tool
currently being used in the view.Sets a vertical
ruler
to synchronize with the view state.Sets the zoom
level
for the view, where a zoom level of 1.0 corresponds to 100%.- param event
Returns the currently active tool for the view.
Ungroups all selected items.
Unlocks all locked items in the layout.
Unsets the current view tool, if it matches the specified
tool
.Updates associated rulers and other widgets after view extent or zoom has changed.
Returns a list of page numbers for pages which are currently visible in the view.
Returns a list of page items which are currently visible in the view.
- param event
Zooms to the actual size of the layout.
Zooms the view to the full extent of the layout.
Zooms in to the view by a preset amount.
Zooms out of the view by a preset amount.
Zooms the view to the full width of the layout.
Signals
Emitted when the mouse cursor coordinates change within the view.
Emitted when an
item
is "focused" in the view, i.e. it becomes the active item and should have its properties displayed in any designer windows.Emitted when a
layout
is set for the view.Emitted when the page visible in the view is changed.
Emitted when the view has a
message
for display in a parent window's status bar.Emitted when the current
tool
is changed.Emitted in the destructor when the view is about to be deleted, but is still in a perfectly valid state.
Emitted whenever the zoom level of the view is changed.
Attributes
- ClipboardCopy = 1¶
- ClipboardCut = 0¶
- class ClipboardOperation¶
Bases:
int
- class PasteMode¶
Bases:
int
- PasteModeCenter = 1¶
- PasteModeCursor = 0¶
- PasteModeInPlace = 2¶
- actionEvent(self, QActionEvent)¶
- alignSelectedItems(self, alignment: QgsLayoutAligner.Alignment)¶
Aligns all selected items using the specified
alignment
.See also
See also
- Parameters
alignment (QgsLayoutAligner.Alignment) –
- changeEvent(self, QEvent)¶
- childEvent(self, QChildEvent)¶
- closeEvent(self, QCloseEvent)¶
- connectNotify(self, QMetaMethod)¶
- contextMenuEvent(self, QContextMenuEvent)¶
- copyItems(self, items: Iterable[QgsLayoutItem], operation: QgsLayoutView.ClipboardOperation)¶
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)¶
Cuts or copies the selected items, respecting the specified
operation
.See also
See also
- Parameters
operation (QgsLayoutView.ClipboardOperation) –
- create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)¶
- currentLayout(self) QgsLayout ¶
Returns the current layout associated with the view.
See also
See also
- Return type
- currentPage(self) int ¶
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
- cursorPosChanged¶
Emitted when the mouse cursor coordinates change within the view. The
layoutPoint
argument indicates the cursor position within the layout coordinate system. [signal]- Parameters
layoutPoint (Union[QPointF) –
- customEvent(self, QEvent)¶
- deleteItems(self, items: Iterable[QgsLayoutItem])¶
Delete the specified
items
.See also
- Parameters
items (Iterable[QgsLayoutItem]) –
- deleteSelectedItems(self)¶
Deletes all selected items.
See also
- deltaForKeyEvent(self, event: QKeyEvent) QPointF ¶
Returns the delta (in layout coordinates) by which to move items for the given key
event
.- Parameters
event (QKeyEvent) –
- Return type
QPointF
- deselectAll(self)¶
Deselects all items in the view.
See also
See also
- destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)¶
- disconnectNotify(self, QMetaMethod)¶
- distributeSelectedItems(self, distribution: QgsLayoutAligner.Distribution)¶
Distributes all selected items using the specified
distribution
.See also
See also
- Parameters
distribution (QgsLayoutAligner.Distribution) –
- dragEnterEvent(self, e: QDragEnterEvent)¶
- Parameters
e (QDragEnterEvent) –
- dragLeaveEvent(self, QDragLeaveEvent)¶
- dragMoveEvent(self, QDragMoveEvent)¶
- drawBackground(self, QPainter, QRectF)¶
- drawForeground(self, QPainter, QRectF)¶
- drawFrame(self, QPainter)¶
- dropEvent(self, QDropEvent)¶
- emitZoomLevelChanged(self)¶
- enterEvent(self, QEvent)¶
- event(self, QEvent) bool ¶
- eventFilter(self, QObject, QEvent) bool ¶
- focusInEvent(self, QFocusEvent)¶
- focusNextChild(self) bool ¶
- focusNextPrevChild(self, bool) bool ¶
- focusOutEvent(self, QFocusEvent)¶
- focusPreviousChild(self) bool ¶
- groupSelectedItems(self)¶
Groups all selected items.
See also
- hasItemsInClipboard(self) bool ¶
Returns
True
if the current clipboard contains layout items.See also
- Return type
bool
- hideEvent(self, QHideEvent)¶
- initPainter(self, QPainter)¶
- initStyleOption(self, QStyleOptionFrame)¶
- inputMethodEvent(self, QInputMethodEvent)¶
- invertSelection(self)¶
Inverts the current selection, selecting deselected items and deselecting and selected items.
See also
See also
- isSignalConnected(self, QMetaMethod) bool ¶
- itemFocused¶
Emitted when an
item
is “focused” in the view, i.e. it becomes the active item and should have its properties displayed in any designer windows. [signal]- Parameters
item (QgsLayoutItem) –
- keyPressEvent(self, event: QKeyEvent)¶
- Parameters
event (QKeyEvent) –
- keyReleaseEvent(self, event: QKeyEvent)¶
- Parameters
event (QKeyEvent) –
- layoutSet¶
Emitted when a
layout
is set for the view.See also
See also
setCurrentLayout()
[signal]- Parameters
layout (QgsLayout) –
- leaveEvent(self, QEvent)¶
- lockSelectedItems(self)¶
Locks any selected items, preventing them from being interacted with by mouse interactions.
See also
- lowerSelectedItems(self)¶
Lowers the selected items down the z-order.
See also
See also
See also
Returns the provider for context menus. Returned value may be
None
if no provider is set.See also
- Return type
- metric(self, QPaintDevice.PaintDeviceMetric) int ¶
- mouseDoubleClickEvent(self, event: QMouseEvent)¶
- Parameters
event (QMouseEvent) –
- mouseMoveEvent(self, event: QMouseEvent)¶
- Parameters
event (QMouseEvent) –
- mousePressEvent(self, event: QMouseEvent)¶
- Parameters
event (QMouseEvent) –
- mouseReleaseEvent(self, event: QMouseEvent)¶
- Parameters
event (QMouseEvent) –
- moveEvent(self, QMoveEvent)¶
- moveSelectedItemsToBottom(self)¶
Lowers the selected items to the bottom of the z-order.
See also
See also
See also
- moveSelectedItemsToTop(self)¶
Raises the selected items to the top of the z-order.
See also
See also
See also
- nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) Tuple[bool, int] ¶
- pageChanged¶
Emitted when the page visible in the view is changed. This signal considers the page at the center of the view as the current visible page.
See also
currentPage()
[signal]- Parameters
page (int) –
- paintEvent(self, event: QPaintEvent)¶
- Parameters
event (QPaintEvent) –
- 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
List[QgsLayoutItem]
- previewMode(self) QgsPreviewEffect.PreviewMode ¶
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 ¶
Returns
True
if a preview effect is being used to alter the view’s appearance.See also
- Return type
bool
- pushStatusMessage(self, message: str)¶
Pushes a new status bar
message
to 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 (str) –
- raiseSelectedItems(self)¶
Raises the selected items up the z-order.
See also
See also
See also
- receivers(self, PYQT_SIGNAL) int ¶
- resizeEvent(self, event: QResizeEvent)¶
- Parameters
event (QResizeEvent) –
- resizeSelectedItems(self, resize: QgsLayoutAligner.Resize)¶
Resizes all selected items using the specified
resize
mode.See also
See also
- Parameters
resize (QgsLayoutAligner.Resize) –
- scaleSafe(self, scale: float)¶
Scales the view in a safe way, by limiting the acceptable range of the scale applied. The
scale
parameter specifies the zoom factor to scale the view by.- Parameters
scale (float) –
- scrollContentsBy(self, dx: int, dy: int)¶
- Parameters
dx (int) –
dy (int) –
- selectAll(self)¶
Selects all items in the view.
See also
See also
See also
See also
- selectNextItemAbove(self)¶
Selects the next item above the existing selection, by item z order.
See also
See also
See also
- selectNextItemBelow(self)¶
Selects the next item below the existing selection, by item z order.
See also
See also
See also
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setCurrentLayout(self, layout: QgsLayout)¶
Sets the current
layout
to edit in the view.See also
See also
- Parameters
layout (QgsLayout) –
- setHorizontalRuler(self, ruler: QgsLayoutRuler)¶
Sets a horizontal
ruler
to synchronize with the view state.See also
- Parameters
ruler (QgsLayoutRuler) –
- setMenuProvider(self, provider: QgsLayoutViewMenuProvider)¶
Sets a
provider
for context menus. Ownership of the provider is transferred to the view.See also
- Parameters
provider (QgsLayoutViewMenuProvider) –
- setPreviewMode(self, mode: QgsPreviewEffect.PreviewMode)¶
Sets the preview
mode
which 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)¶
Sets whether a preview effect should be used to alter the view’s appearance.
- Parameters
enabled (bool) – Set to
True
to enable the preview effect on the view.
See also
- setSectionLabel(self, label: str)¶
Sets a section
label
, to display above the first page shown in the view.- Parameters
label (str) –
- setTool(self, tool: QgsLayoutViewTool)¶
Sets the
tool
currently being used in the view.See also
See also
- Parameters
tool (QgsLayoutViewTool) –
- setVerticalRuler(self, ruler: QgsLayoutRuler)¶
Sets a vertical
ruler
to synchronize with the view state.See also
- Parameters
ruler (QgsLayoutRuler) –
- QgsLayoutView.setViewportMargins(self, int, int, int, int)
- setViewportMargins(self, QMargins) None ¶
- setZoomLevel(self, level: float)¶
Sets the zoom
level
for the view, where a zoom level of 1.0 corresponds to 100%.- Parameters
level (float) –
- setupViewport(self, QWidget)¶
- showEvent(self, event: QShowEvent)¶
- Parameters
event (QShowEvent) –
- statusMessage¶
Emitted when the view has a
message
for display in a parent window’s status bar.See also
pushStatusMessage()
[signal]- Parameters
message (str) –
- tabletEvent(self, QTabletEvent)¶
- timerEvent(self, QTimerEvent)¶
- tool(self) QgsLayoutViewTool ¶
Returns the currently active tool for the view.
See also
- Return type
- toolSet¶
Emitted when the current
tool
is changed.See also
setTool()
[signal]- Parameters
tool (QgsLayoutViewTool) –
- ungroupSelectedItems(self)¶
Ungroups all selected items.
See also
- unlockAllItems(self)¶
Unlocks all locked items in the layout.
See also
- unsetTool(self, tool: QgsLayoutViewTool)¶
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,
QgsLayoutViewTool
takes care of it.- Parameters
tool (QgsLayoutViewTool) –
- updateMicroFocus(self)¶
- viewChanged(self)¶
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().
- viewportEvent(self, QEvent) bool ¶
- viewportMargins(self) QMargins ¶
- viewportSizeHint(self) QSize ¶
- 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
List[QgsLayoutItemPage]
- wheelEvent(self, event: QWheelEvent)¶
- Parameters
event (QWheelEvent) –
- willBeDeleted¶
Emitted in the destructor when the view is about to be deleted, but is still in a perfectly valid state. [signal]
- zoomActual(self)¶
Zooms to the actual size of the layout.
See also
See also
See also
- zoomFull(self)¶
Zooms the view to the full extent of the layout.
See also
See also
See also
- zoomIn(self)¶
Zooms in to the view by a preset amount.
See also
See also
See also
- zoomLevelChanged¶
Emitted whenever the zoom level of the view is changed. [signal]
- zoomOut(self)¶
Zooms out of the view by a preset amount.
See also
See also
See also
- zoomWidth(self)¶
Zooms the view to the full width of the layout.
See also
See also
See also