Class: QgsLayoutViewTool¶
Abstract base class for all layout view tools.
Layout view tools are user interactive tools for manipulating and adding
items to QgsLayoutView widgets.
Class Hierarchy¶
Base classes¶
Subclasses¶
Layout view tool for adding items to a layout. |
|
Layout view tool for adding node based items to a layout. |
|
Layout view tool for editing node based items in the layout. |
|
Layout view tool for moving and zooming item content. |
|
Layout view tool for panning the layout. |
|
Layout view tool for selecting items in the layout. |
|
Layout view tool for temporarily panning a layout while a key is depressed. |
|
Layout view tool for zooming into and out of the layout. |
|
Layout view tool for temporarily panning a layout while a mouse button is depressed. |
- class qgis.gui.QgsLayoutViewTool[source]¶
Bases:
QObject- __init__(view: QgsLayoutView | None, name: str | None)
Constructor for QgsLayoutViewTool, taking a layout
viewand toolnameas parameters.- Parameters:
view (Optional[QgsLayoutView])
name (Optional[str])
- class Flag¶
Bases:
int
- FlagSnaps = 2¶
- class Flags¶
- class Flags(f: QgsLayoutViewTool.Flags | QgsLayoutViewTool.Flag)
- class Flags(a0: QgsLayoutViewTool.Flags)
Bases:
object
- action(self) QAction | None[source]¶
Returns the action associated with the tool or
Noneif no action is associated.See also
- Return type:
Optional[QAction]
- virtual activate(self)[source]¶
Called when tool is set as the currently active layout tool. Overridden implementations must take care to call the base class implementation.
- signal activated[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.
- virtual deactivate(self)[source]¶
Called when tool is deactivated. Overridden implementations must take care to call the base class implementation.
- signal deactivated[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.
- flags(self) QgsLayoutViewTool.Flags[source]¶
Returns the current combination of flags set for the tool.
See also
- Return type:
- virtual ignoredSnapItems(self) List[QgsLayoutItem]¶
Returns a list of items which should be ignored while snapping events for this tool.
- Return type:
- isClickAndDrag(self, startViewPoint: QPoint, endViewPoint: QPoint) bool[source]¶
Returns
Trueif a mouse press/release operation which started atstartViewPointand ended atendViewPointshould be considered a “click and drag”. IfFalseis returned, the operation should be instead treated as just a click onstartViewPoint.- Parameters:
startViewPoint (QPoint)
endViewPoint (QPoint)
- Return type:
bool
- 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.
- virtual keyPressEvent(self, event: QKeyEvent | None)[source]¶
Key press event for overriding. Default implementation does nothing.
- Parameters:
event (Optional[QKeyEvent])
- virtual keyReleaseEvent(self, event: QKeyEvent | None)[source]¶
Key release event for overriding. Default implementation does nothing.
- Parameters:
event (Optional[QKeyEvent])
- layout(self) QgsLayout | None[source]¶
Returns the layout associated with the tool.
See also
- Return type:
Optional[QgsLayout]
- virtual layoutDoubleClickEvent(self, event: QgsLayoutViewMouseEvent | None)[source]¶
Mouse double-click event for overriding. Default implementation does nothing.
- Parameters:
event (Optional[QgsLayoutViewMouseEvent])
- virtual layoutMoveEvent(self, event: QgsLayoutViewMouseEvent | None)[source]¶
Mouse move event for overriding. Default implementation does nothing.
- Parameters:
event (Optional[QgsLayoutViewMouseEvent])
- virtual layoutPressEvent(self, event: QgsLayoutViewMouseEvent | None)[source]¶
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).
- Parameters:
event (Optional[QgsLayoutViewMouseEvent])
- virtual layoutReleaseEvent(self, event: QgsLayoutViewMouseEvent | None)[source]¶
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).
- Parameters:
event (Optional[QgsLayoutViewMouseEvent])
- setAction(self, action: QAction | None)[source]¶
Associates an
actionwith this tool. When the setLayoutTool method ofQgsLayoutViewis 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
- Parameters:
action (Optional[QAction])
- setCursor(self, cursor: QCursor | Qt.CursorShape)[source]¶
Sets a user defined
cursorfor use when the tool is active.- Parameters:
cursor (Union[QCursor, Qt.CursorShape])
- setFlags(self, flags: QgsLayoutViewTool.Flags | QgsLayoutViewTool.Flag)[source]¶
Sets the combination of
flagsthat will be used for the tool.See also
- Parameters:
flags (Union[QgsLayoutViewTool.Flags, QgsLayoutViewTool.Flag])
- view(self) QgsLayoutView | None[source]¶
Returns the view associated with the tool.
See also
- Return type:
Optional[QgsLayoutView]