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¶
- class qgis.gui.QgsLayoutRuler[source]¶
Bases:
QWidget- __init__(parent: QWidget | None = None, orientation: Qt.Orientation = Qt.Horizontal)
Constructor for QgsLayoutRuler, with the specified
parentwidget andorientation.- Parameters:
parent (Optional[QWidget] = None)
orientation (Qt.Orientation = Qt.Horizontal)
- signal cursorPosChanged[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.
- 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
menuto show when right clicking occurs on the ruler. Ownership ofmenuis unchanged.- Parameters:
menu (Optional[QMenu])
- setCursorPosition(self, position: QPointF | QPoint)[source]¶
Updates the
positionof the marker showing the current mouse position within the view.positionis in layout coordinates.- Parameters:
position (Union[QPointF, QPoint])
- setLayoutView(self, view: QgsLayoutView | None)[source]¶
Sets the current layout
viewto synchronize the ruler with.See also
- Parameters:
view (Optional[QgsLayoutView])