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()
changeEvent()
childEvent()
closeEvent()
connectNotify()
contextMenuEvent()
create()
cursorPosChanged

Is emitted when mouse cursor coordinates change [signal]

customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enterEvent()
event()
focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
hideEvent()
initPainter()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
layoutView(self) → QgsLayoutView

Returns the current layout view associated with the ruler.

See also

setLayoutView()

Return type

QgsLayoutView

leaveEvent()
metric()
minimumSizeHint(self) → QSize
Return type

QSize

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

event (QMouseEvent) –

mousePressEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

mouseReleaseEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

moveEvent()
nativeEvent()
paintEvent(self, event: QPaintEvent)
Parameters

event (QPaintEvent) –

receivers()
resizeEvent()
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()
senderSignalIndex()
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()
showEvent()
tabletEvent()
timerEvent()
updateMicroFocus()
wheelEvent()