Class: QgsLayoutRuler

class qgis.gui.QgsLayoutRuler(parent: QWidget = None, orientation: Qt.Orientation = Qt.Horizontal)

Bases: PyQt5.QtWidgets.QWidget

Constructor for QgsLayoutRuler, with the specified parent widget and orientation.

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.

New in version 3.0.

Parameters
  • parent (QWidget = None) –

  • orientation

actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
cursorPosChanged

Emitted when mouse cursor coordinates change [signal]

customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) → bool
focusInEvent(self, QFocusEvent)
focusNextChild(self) → bool
focusNextPrevChild(self, bool) → bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) → bool
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) → bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
layoutView(self)QgsLayoutView

Returns the current layout view associated with the ruler.

See also

setLayoutView()

Return type

QgsLayoutView

leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) → int
minimumSizeHint(self) → QSize
Return type

QSize

mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

mousePressEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

mouseReleaseEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) → Tuple[bool, int]
paintEvent(self, event: QPaintEvent)
Parameters

event (QPaintEvent) –

receivers(self, PYQT_SIGNAL) → int
resizeEvent(self, QResizeEvent)
rulerSize(self) → int

Returns the ruler size (either the height of a horizontal ruler or the width of a vertical rule).

Return type

int

sender(self) → QObject
senderSignalIndex(self) → int
setContextMenu(self, menu: QMenu)

Sets a context menu to show when right clicking occurs on the ruler. Ownership of menu is unchanged.

Parameters

menu (QMenu) –

setCursorPosition(self, position: Union[QPointF, QPoint])

Updates the position of the marker showing the current mouse position within the view. position is in layout coordinates.

Parameters

position (Union[QPointF) –

setLayoutView(self, view: QgsLayoutView)

Sets the current layout view to synchronize the ruler with.

See also

layoutView()

Parameters

view (QgsLayoutView) –

setSceneTransform(self, transform: QTransform)

Sets the current scene transform. This is usually the transform set for a view showing the associated scene, in order to synchronize the view’s display of the scene with the rulers.

Parameters

transform (QTransform) –

sharedPainter(self) → QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
wheelEvent(self, QWheelEvent)