Subgroup: Layout

Class: QgsLayoutViewTool

class qgis.gui.QgsLayoutViewTool

Bases: PyQt5.QtCore.QObject

Abstract base class for all layout view tools. Layout view tools are user interactive tools for manipulating and adding items to QgsLayoutView widgets.

New in version 3.0: Methods

action Returns the action associated with the tool or None if no action is associated.
activate Called when tool is set as the currently active layout tool.
blockSignals
childEvent
children
connectNotify
customEvent
deactivate Called when tool is deactivated.
deleteLater
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
event
eventFilter
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]
flags Returns the current combination of flags set for the tool.
ignoredSnapItems Returns a list of items which should be ignored while snapping events for this tool.
inherits
installEventFilter
isClickAndDrag Returns true if a mouse press/release operation which started at startViewPoint and ended at endViewPoint should be considered a “click and drag”.
isSignalConnected
isWidgetType
isWindowType
keyPressEvent Key press event for overriding.
keyReleaseEvent Key release event for overriding.
killTimer
layout Returns the layout associated with the tool.
layoutDoubleClickEvent Mouse double-click event for overriding.
layoutMoveEvent Mouse move event for overriding.
layoutPressEvent Mouse press event for overriding.
layoutReleaseEvent Mouse release event for overriding.
metaObject
moveToThread
objectName
parent
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
receivers
removeEventFilter
sender
senderSignalIndex
setAction Associates an action with this tool.
setCursor Sets a user defined cursor for use when the tool is active.
setFlags Sets the combination of flags that will be used for the tool.
setObjectName
setParent
setProperty
signalsBlocked
startTimer
thread
timerEvent
toolName Returns a user-visible, translated name for the tool.
tr
view Returns the view associated with the tool.
wheelEvent Mouse wheel event for overriding.

Attributes

FlagSnaps
activated Emitted when the tool is activated.
deactivated Emitted when the tool is deactivated.
destroyed destroyed(self, QObject = None) [signal]
itemFocused Emitted when an item is “focused” by the tool, i.e.
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
class Flag

Bases: int

FlagSnaps = 2
class Flags

Bases: sip.wrapper

QgsLayoutViewTool.Flags(Union[QgsLayoutViewTool.Flags, QgsLayoutViewTool.Flag]) QgsLayoutViewTool.Flags(QgsLayoutViewTool.Flags)

action(self) → QAction

Returns the action associated with the tool or None if no action is associated.

See also

setAction()

activate(self)

Called when tool is set as the currently active layout tool. Overridden implementations must take care to call the base class implementation.

activated

Emitted when the tool is activated. [signal]

childEvent()
connectNotify()
customEvent()
deactivate(self)

Called when tool is deactivated. Overridden implementations must take care to call the base class implementation.

deactivated

Emitted when the tool is deactivated. [signal]

disconnectNotify()
flags(self) → QgsLayoutViewTool.Flags

Returns the current combination of flags set for the tool.

See also

setFlags()

ignoredSnapItems(self) → List[QgsLayoutItem]

Returns a list of items which should be ignored while snapping events for this tool.

isClickAndDrag(self, startViewPoint: QPoint, endViewPoint: QPoint) → bool

Returns true if a mouse press/release operation which started at startViewPoint and ended at endViewPoint should be considered a “click and drag”. If false is returned, the operation should be instead treated as just a click on startViewPoint.

isSignalConnected()
itemFocused

Emitted when an item is “focused” by the tool, i.e. it should become the active item and should have its properties displayed in any designer windows. [signal]

keyPressEvent(self, event: QKeyEvent)

Key press event for overriding. Default implementation does nothing.

keyReleaseEvent(self, event: QKeyEvent)

Key release event for overriding. Default implementation does nothing.

layout(self) → QgsLayout

Returns the layout associated with the tool.

See also

view()

layoutDoubleClickEvent(self, event: QgsLayoutViewMouseEvent)

Mouse double-click event for overriding. Default implementation does nothing.

layoutMoveEvent(self, event: QgsLayoutViewMouseEvent)

Mouse move event for overriding. Default implementation does nothing.

layoutPressEvent(self, event: QgsLayoutViewMouseEvent)

Mouse press event for overriding. Default implementation does nothing. Note that subclasses must ensure that they correctly handle cases when a layoutPressEvent is called without a corresponding layoutReleaseEvent (e.g. due to tool being changed mid way through a press-release operation).

layoutReleaseEvent(self, event: QgsLayoutViewMouseEvent)

Mouse release event for overriding. Default implementation does nothing. Note that subclasses must ensure that they correctly handle cases when a layoutPressEvent is called without a corresponding layoutReleaseEvent (e.g. due to tool being changed mid way through a press-release operation).

receivers()
sender()
senderSignalIndex()
setAction(self, action: QAction)

Associates an action with this tool. When the setLayoutTool method of QgsLayoutView is called the action’s state will be set to on. Usually this will cause a toolbutton to appear pressed in and the previously used toolbutton to pop out.

See also

action()

setCursor(self, cursor: Union[QCursor, Qt.CursorShape])

Sets a user defined cursor for use when the tool is active.

setFlags(self, flags: Union[QgsLayoutViewTool.Flags, QgsLayoutViewTool.Flag])

Sets the combination of flags that will be used for the tool.

See also

flags()

timerEvent()
toolName(self) → str

Returns a user-visible, translated name for the tool.

view(self) → QgsLayoutView

Returns the view associated with the tool.

See also

layout()

wheelEvent(self, event: QWheelEvent)

Mouse wheel event for overriding. Default implementation does nothing.