Subgroup: Layout
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: Methods
acceptDrops
accessibleDescription
accessibleName
actionEvent
actions
activateWindow
addAction
addActions
addScrollBarWidget
adjustSize
alignSelectedItems
Aligns all selected items using the specified alignment
.alignment
autoFillBackground
backgroundBrush
backgroundRole
baseSize
blockSignals
cacheMode
centerOn
centerOn(self, QGraphicsItem) changeEvent
childAt
childAt(self, int, int) -> QWidget childEvent
children
childrenRect
childrenRegion
clearFocus
clearMask
close
closeEvent
colorCount
connectNotify
contentsMargins
contentsRect
contextMenuEvent
contextMenuPolicy
copyItems
Cuts or copies the a list of items
, respecting the specifiedoperation
.copySelectedItems
Cuts or copies the selected items, respecting the specified operation
.cornerWidget
create
createWindowContainer
currentLayout
Returns the current layout associated with the view. currentPage
Returns the page visible in the view. cursor
customEvent
deleteItems
Delete the specified items
.deleteLater
deleteSelectedItems
Deletes all selected items. deltaForKeyEvent
Returns the delta (in layout coordinates) by which to move items for the given key event
.depth
deselectAll
Deselects all items in the view. destroy
devType
devicePixelRatio
devicePixelRatioF
devicePixelRatioFScale
disconnect
disconnectNotify
distributeSelectedItems
Distributes all selected items using the specified distribution
.dragEnterEvent
dragLeaveEvent
dragMode
dragMoveEvent
drawBackground
drawForeground
drawFrame
dropEvent
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
effectiveWinId
emitZoomLevelChanged
ensurePolished
ensureVisible
ensureVisible(self, QGraphicsItem, xMargin: int = 50, yMargin: int = 50) enterEvent
event
eventFilter
find
findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] fitInView
fitInView(self, QGraphicsItem, mode: Qt.AspectRatioMode = Qt.IgnoreAspectRatio) focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPolicy
focusPreviousChild
focusProxy
focusWidget
font
fontInfo
fontMetrics
foregroundBrush
foregroundRole
frameGeometry
frameRect
frameShadow
frameShape
frameSize
frameStyle
frameWidth
geometry
getContentsMargins
grab
grabGesture
grabKeyboard
grabMouse
grabMouse(self, Union[QCursor, Qt.CursorShape]) grabShortcut
graphicsEffect
graphicsProxyWidget
groupSelectedItems
Groups all selected items. hasFocus
hasHeightForWidth
hasItemsInClipboard
Returns true if the current clipboard contains layout items. hasMouseTracking
hasTabletTracking
height
heightForWidth
heightMM
hide
hideEvent
horizontalScrollBar
horizontalScrollBarPolicy
inherits
initPainter
initStyleOption
inputMethodEvent
inputMethodHints
inputMethodQuery
insertAction
insertActions
installEventFilter
invalidateScene
invertSelection
Inverts the current selection, selecting deselected items and deselecting and selected items. isActiveWindow
isAncestorOf
isEnabled
isEnabledTo
isFullScreen
isHidden
isInteractive
isLeftToRight
isMaximized
isMinimized
isModal
isRightToLeft
isSignalConnected
isTransformed
isVisible
isVisibleTo
isWidgetType
isWindow
isWindowModified
isWindowType
itemAt
itemAt(self, int, int) -> QGraphicsItem items
items(self, QPoint) -> List[QGraphicsItem] keyPressEvent
keyReleaseEvent
keyboardGrabber
killTimer
layout
layoutDirection
leaveEvent
lineWidth
locale
lockSelectedItems
Locks any selected items, preventing them from being interacted with by mouse interactions. logicalDpiX
logicalDpiY
lower
lowerSelectedItems
Lowers the selected items down the z-order. mapFrom
mapFromGlobal
mapFromParent
mapFromScene
mapFromScene(self, QRectF) -> QPolygon mapTo
mapToGlobal
mapToParent
mapToScene
mapToScene(self, QRect) -> QPolygonF mask
maximumHeight
maximumSize
maximumViewportSize
maximumWidth
menuProvider
Returns the provider for context menus. metaObject
metric
midLineWidth
minimumHeight
minimumSize
minimumSizeHint
minimumWidth
mouseDoubleClickEvent
mouseGrabber
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
move
move(self, int, int) moveEvent
moveSelectedItemsToBottom
Lowers the selected items to the bottom of the z-order. moveSelectedItemsToTop
Raises the selected items to the top of the z-order. moveToThread
nativeEvent
nativeParentWidget
nextInFocusChain
normalGeometry
objectName
optimizationFlags
overrideWindowFlags
overrideWindowState
paintEngine
paintEvent
paintingActive
palette
parent
parentWidget
pasteItems
Pastes items from clipboard, using the specified mode
.physicalDpiX
physicalDpiY
pos
previewMode
Returns the preview mode which may be used to modify the view’s appearance. previewModeEnabled
Returns true if a preview effect is being used to alter the view’s appearance. previousInFocusChain
property
pushStatusMessage
Pushes a new status bar message
to the view.pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. raiseSelectedItems
Raises the selected items up the z-order. raise_
receivers
rect
releaseKeyboard
releaseMouse
releaseShortcut
removeAction
removeEventFilter
render
renderHints
repaint
repaint(self, int, int, int, int) resetCachedContent
resetTransform
resize
resize(self, int, int) resizeAnchor
resizeEvent
resizeSelectedItems
Resizes all selected items using the specified resize
mode.restoreGeometry
rotate
rubberBandRect
rubberBandSelectionMode
saveGeometry
scale
scaleSafe
Scales the view in a safe way, by limiting the acceptable range of the scale applied. scene
sceneRect
scroll
scroll(self, int, int, QRect) scrollBarWidgets
scrollContentsBy
selectAll
Selects all items in the view. selectNextItemAbove
Selects the next item above the existing selection, by item z order. selectNextItemBelow
Selects the next item below the existing selection, by item z order. sender
senderSignalIndex
setAcceptDrops
setAccessibleDescription
setAccessibleName
setAlignment
setAttribute
setAutoFillBackground
setBackgroundBrush
setBackgroundRole
setBaseSize
setBaseSize(self, QSize) setCacheMode
setContentsMargins
setContentsMargins(self, QMargins) setContextMenuPolicy
setCornerWidget
setCurrentLayout
Sets the current layout
to edit in the view.setCursor
setDisabled
setDragMode
setEnabled
setFixedHeight
setFixedSize
setFixedSize(self, int, int) setFixedWidth
setFocus
setFocus(self, Qt.FocusReason) setFocusPolicy
setFocusProxy
setFont
setForegroundBrush
setForegroundRole
setFrameRect
setFrameShadow
setFrameShape
setFrameStyle
setGeometry
setGeometry(self, int, int, int, int) setGraphicsEffect
setHidden
setHorizontalRuler
Sets a horizontal ruler
to synchronize with the view state.setHorizontalScrollBar
setHorizontalScrollBarPolicy
setInputMethodHints
setInteractive
setLayout
setLayoutDirection
setLineWidth
setLocale
setMask
setMask(self, QRegion) setMaximumHeight
setMaximumSize
setMaximumSize(self, QSize) setMaximumWidth
setMenuProvider
Sets a provider
for context menus.setMidLineWidth
setMinimumHeight
setMinimumSize
setMinimumSize(self, QSize) setMinimumWidth
setMouseTracking
setObjectName
setOptimizationFlag
setOptimizationFlags
setPalette
setParent
setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType]) setPreviewMode
Sets the preview mode
which should be used to modify the view’s appearance.setPreviewModeEnabled
Sets whether a preview effect should be used to alter the view’s appearance. setProperty
setRenderHint
setRenderHints
setResizeAnchor
setRubberBandSelectionMode
setScene
setSceneRect
setSceneRect(self, float, float, float, float) setSectionLabel
Sets a section label
, to display above the first page shown in the view.setShortcutAutoRepeat
setShortcutEnabled
setSizeAdjustPolicy
setSizeIncrement
setSizeIncrement(self, QSize) setSizePolicy
setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy) setStatusTip
setStyle
setStyleSheet
setTabOrder
setTabletTracking
setTool
Sets the tool
currently being used in the view.setToolTip
setToolTipDuration
setTransform
setTransformationAnchor
setUpdatesEnabled
setVerticalRuler
Sets a vertical ruler
to synchronize with the view state.setVerticalScrollBar
setVerticalScrollBarPolicy
setViewport
setViewportMargins
setViewportUpdateMode
setVisible
setWhatsThis
setWindowFilePath
setWindowFlag
setWindowFlags
setWindowIcon
setWindowIconText
setWindowModality
setWindowModified
setWindowOpacity
setWindowRole
setWindowState
setWindowTitle
setZoomLevel
Sets the zoom level
for the view, where a zoom level of 1.0 corresponds to 100%.setupViewport
sharedPainter
shear
show
showEvent
showFullScreen
showMaximized
showMinimized
showNormal
signalsBlocked
size
sizeAdjustPolicy
sizeHint
sizeIncrement
sizePolicy
stackUnder
startTimer
statusTip
style
styleSheet
tabletEvent
testAttribute
thread
timerEvent
tool
Returns the currently active tool for the view. toolTip
toolTipDuration
tr
transform
transformationAnchor
translate
underMouse
ungrabGesture
ungroupSelectedItems
Ungroups all selected items. unlockAllItems
Unlocks all locked items in the layout. unsetCursor
unsetLayoutDirection
unsetLocale
unsetTool
Unsets the current view tool, if it matches the specified tool
.update
update(self, QRect) updateGeometry
updateMicroFocus
updateScene
updateSceneRect
updatesEnabled
verticalScrollBar
verticalScrollBarPolicy
viewChanged
Updates associated rulers and other widgets after view extent or zoom has changed. viewport
viewportEvent
viewportMargins
viewportSizeHint
viewportTransform
viewportUpdateMode
visiblePageNumbers
Returns a list of page numbers for pages which are currently visible in the view. visiblePages
Returns a list of page items which are currently visible in the view. visibleRegion
whatsThis
wheelEvent
width
widthMM
winId
window
windowFilePath
windowFlags
windowHandle
windowIcon
windowIconText
windowModality
windowOpacity
windowRole
windowState
windowTitle
windowType
x
y
zoomActual
Zooms to the actual size of the layout. zoomFull
Zooms the view to the full extent of the layout. zoomIn
Zooms in to the view by a preset amount. zoomOut
Zooms out of the view by a preset amount. zoomWidth
Zooms the view to the full width of the layout. Attributes
AdjustIgnored
AdjustToContents
AdjustToContentsOnFirstShow
AnchorUnderMouse
AnchorViewCenter
BoundingRectViewportUpdate
Box
CacheBackground
CacheNone
ClipboardCopy
ClipboardCut
DontAdjustForAntialiasing
DontClipPainter
DontSavePainterState
DrawChildren
DrawWindowBackground
FullViewportUpdate
HLine
IgnoreMask
MinimalViewportUpdate
NoAnchor
NoDrag
NoFrame
NoViewportUpdate
Panel
PasteModeCenter
PasteModeCursor
PasteModeInPlace
PdmDepth
PdmDevicePixelRatio
PdmDevicePixelRatioScaled
PdmDpiX
PdmDpiY
PdmHeight
PdmHeightMM
PdmNumColors
PdmPhysicalDpiX
PdmPhysicalDpiY
PdmWidth
PdmWidthMM
Plain
Raised
RubberBandDrag
ScrollHandDrag
Shadow_Mask
Shape_Mask
SmartViewportUpdate
StyledPanel
Sunken
VLine
WinPanel
cursorPosChanged
Is emitted when the mouse cursor coordinates change within the view. customContextMenuRequested
customContextMenuRequested(self, QPoint) [signal] destroyed
destroyed(self, QObject = None) [signal] itemFocused
Emitted when an item
is “focused” in the view, i.e.layoutSet
Emitted when a layout
is set for the view.objectNameChanged
objectNameChanged(self, str) [signal] pageChanged
Emitted when the page visible in the view is changed. rubberBandChanged
rubberBandChanged(self, QRect, Union[QPointF, QPoint], Union[QPointF, QPoint]) [signal] staticMetaObject
statusMessage
Emitted when the view has a message
for display in a parent window’s status bar.toolSet
Emitted when the current tool
is changed.windowIconChanged
windowIconChanged(self, QIcon) [signal] windowIconTextChanged
windowIconTextChanged(self, str) [signal] windowTitleChanged
windowTitleChanged(self, str) [signal] zoomLevelChanged
Is emitted whenever the zoom level of the view is changed. -
ClipboardCopy
= 1¶
-
ClipboardCut
= 0¶
-
class
ClipboardOperation
¶ Bases:
int
-
class
PasteMode
¶ Bases:
int
-
PasteModeCenter
= 1¶
-
PasteModeCursor
= 0¶
-
PasteModeInPlace
= 2¶
-
actionEvent
()¶
-
alignSelectedItems
(self, alignment: QgsLayoutAligner.Alignment)¶ Aligns all selected items using the specified
alignment
.See also
See also
-
changeEvent
()¶
-
childEvent
()¶
-
closeEvent
()¶
-
connectNotify
()¶
-
contextMenuEvent
()¶
-
copyItems
(self, items: Iterable[QgsLayoutItem], operation: QgsLayoutView.ClipboardOperation)¶ Cuts or copies the a list of
items
, respecting the specifiedoperation
.See also
See also
-
copySelectedItems
(self, operation: QgsLayoutView.ClipboardOperation)¶ Cuts or copies the selected items, respecting the specified
operation
.See also
See also
-
create
()¶
-
currentLayout
(self) → QgsLayout¶ Returns the current layout associated with the view.
See also
See also
-
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
-
cursorPosChanged
¶ Is emitted when the mouse cursor coordinates change within the view. The
layoutPoint
argument indicates the cursor position within the layout coordinate system. [signal]
-
customEvent
()¶
-
deleteItems
(self, items: Iterable[QgsLayoutItem])¶ Delete the specified
items
.See also
-
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
.
-
deselectAll
(self)¶ Deselects all items in the view.
See also
See also
-
destroy
()¶
-
disconnectNotify
()¶
-
distributeSelectedItems
(self, distribution: QgsLayoutAligner.Distribution)¶ Distributes all selected items using the specified
distribution
.See also
See also
-
dragEnterEvent
(self, e: QDragEnterEvent)¶
-
dragLeaveEvent
()¶
-
dragMoveEvent
()¶
-
drawBackground
()¶
-
drawForeground
()¶
-
drawFrame
()¶
-
dropEvent
()¶
-
emitZoomLevelChanged
(self)¶
-
enterEvent
()¶
-
event
()¶
-
eventFilter
()¶
-
focusInEvent
()¶
-
focusNextChild
()¶
-
focusNextPrevChild
()¶
-
focusOutEvent
()¶
-
focusPreviousChild
()¶
-
groupSelectedItems
(self)¶ Groups all selected items.
See also
-
hasItemsInClipboard
(self) → bool¶ Returns true if the current clipboard contains layout items.
See also
-
hideEvent
()¶
-
initPainter
()¶
-
initStyleOption
()¶
-
inputMethodEvent
()¶
-
invertSelection
(self)¶ Inverts the current selection, selecting deselected items and deselecting and selected items.
See also
See also
-
isSignalConnected
()¶
-
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]
-
keyPressEvent
(self, event: QKeyEvent)¶
-
keyReleaseEvent
(self, event: QKeyEvent)¶
-
layoutSet
¶ Emitted when a
layout
is set for the view.See also
See also
setCurrentLayout()
[signal]
-
leaveEvent
()¶
-
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
-
metric
()¶
-
mouseDoubleClickEvent
(self, event: QMouseEvent)¶
-
mouseMoveEvent
(self, event: QMouseEvent)¶
-
mousePressEvent
(self, event: QMouseEvent)¶
-
mouseReleaseEvent
(self, event: QMouseEvent)¶
-
moveEvent
()¶
-
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
()¶
-
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]
-
paintEvent
(self, 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
-
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() is true.
See also
See also
-
previewModeEnabled
(self) → bool¶ Returns true if a preview effect is being used to alter the view’s appearance.
See also
-
pushStatusMessage
(self, message: str)¶ Pushes a new status bar
message
to the view. This causes statusMessage() to be emitted, which should cause the message to appear in the status bar for the parent window.See also
-
raiseSelectedItems
(self)¶ Raises the selected items up the z-order.
See also
See also
See also
-
receivers
()¶
-
resizeEvent
(self, event: QResizeEvent)¶
-
resizeSelectedItems
(self, resize: QgsLayoutAligner.Resize)¶ Resizes all selected items using the specified
resize
mode.See also
See also
-
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.
-
scrollContentsBy
(self, 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
()¶
-
senderSignalIndex
()¶
-
setCurrentLayout
(self, layout: QgsLayout)¶ Sets the current
layout
to edit in the view.See also
See also
-
setHorizontalRuler
(self, ruler: QgsLayoutRuler)¶ Sets a horizontal
ruler
to synchronize with the view state.See also
-
setMenuProvider
(self, provider: QgsLayoutViewMenuProvider)¶ Sets a
provider
for context menus. Ownership of the provider is transferred to the view.See also
-
setPreviewMode
(self, mode: QgsPreviewEffect.PreviewMode)¶ Sets the preview
mode
which should be used to modify the view’s appearance. Preview modes are only used if previewModeEnabled() is true.See also
See also
-
setPreviewModeEnabled
(self, enabled: bool)¶ Sets whether a preview effect should be used to alter the view’s appearance.
Parameters: enabled – 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.
-
setTool
(self, tool: QgsLayoutViewTool)¶ Sets the
tool
currently being used in the view.See also
See also
-
setVerticalRuler
(self, ruler: QgsLayoutRuler)¶ Sets a vertical
ruler
to synchronize with the view state.See also
-
setViewportMargins
()¶
-
setZoomLevel
(self, level: float)¶ Sets the zoom
level
for the view, where a zoom level of 1.0 corresponds to 100%.
-
setupViewport
()¶
-
showEvent
()¶
-
statusMessage
¶ Emitted when the view has a
message
for display in a parent window’s status bar.See also
pushStatusMessage()
[signal]
-
tabletEvent
()¶
-
timerEvent
()¶
-
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.
-
updateMicroFocus
()¶
-
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
()¶
-
viewportMargins
()¶
-
viewportSizeHint
()¶
-
visiblePageNumbers
(self) → List[int]¶ Returns a list of page numbers for pages which are currently visible in the view.
See also
-
visiblePages
(self) → List[QgsLayoutItemPage]¶ Returns a list of page items which are currently visible in the view.
See also
-
wheelEvent
(self, event: QWheelEvent)¶
-
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
¶ Is 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
-