Class: QgsLayoutRuler¶
A custom ruler widget for use with QgsLayoutView
, displaying
the current zoom and position of the visible layout and for interacting
with guides in a layout.

QgsLayoutRuler¶
Class Hierarchy¶
Base classes¶
Methods
Returns the current layout view associated with the ruler. |
|
Returns the ruler size (either the height of a horizontal ruler or the width of a vertical rule). |
|
Sets a context menu to show when right clicking occurs on the ruler. |
|
Updates the position of the marker showing the current mouse position within the view. |
|
Sets the current layout view to synchronize the ruler with. |
|
Sets the current scene transform. |
Signals
Emitted when mouse cursor coordinates change |
- class qgis.gui.QgsLayoutRuler[source]¶
Bases:
QWidget
- __init__(parent: QWidget | None = None, orientation: Qt.Orientation = Qt.Horizontal)
Constructor for QgsLayoutRuler, with the specified
parent
widget andorientation
.- Parameters:
parent (Optional[QWidget] = None)
orientation (Qt.Orientation = Qt.Horizontal)
- signal cursorPosChanged(position: QPointF)[source]¶
Emitted when mouse cursor coordinates change
- Parameters:
position (QPointF)
- layoutView(self) QgsLayoutView | None [source]¶
Returns the current layout view associated with the ruler.
See also
- Return type:
Optional[QgsLayoutView]
- rulerSize(self) int [source]¶
Returns the ruler size (either the height of a horizontal ruler or the width of a vertical rule).
- Return type:
int
- setContextMenu(self, menu: QMenu | None)[source]¶
Sets a context
menu
to show when right clicking occurs on the ruler. Ownership ofmenu
is unchanged.- Parameters:
menu (Optional[QMenu])
- setCursorPosition(self, position: QPointF | QPoint)[source]¶
Updates the
position
of the marker showing the current mouse position within the view.position
is in layout coordinates.- Parameters:
position (Union[QPointF, QPoint])
- setLayoutView(self, view: QgsLayoutView | None)[source]¶
Sets the current layout
view
to synchronize the ruler with.See also
- Parameters:
view (Optional[QgsLayoutView])