Class: QgsLayoutRuler

class qgis.gui.QgsLayoutRuler

Bases: PyQt5.QtWidgets.QWidget

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.

QgsLayoutRuler(parent: QWidget = None, orientation: Qt.Orientation = Qt.Horizontal) Constructor for QgsLayoutRuler, with the specified parent widget and orientation.

Methods

actionEvent

changeEvent

childEvent

closeEvent

connectNotify

contextMenuEvent

create

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

layoutView

Returns the current layout view associated with the ruler.

leaveEvent

metric

minimumSizeHint

rtype:

QSize

mouseDoubleClickEvent

mouseMoveEvent

param event:

mousePressEvent

param event:

mouseReleaseEvent

param event:

moveEvent

nativeEvent

paintEvent

param event:

receivers

resizeEvent

rulerSize

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

sender

senderSignalIndex

setContextMenu

Sets a context menu to show when right clicking occurs on the ruler.

setCursorPosition

Updates the position of the marker showing the current mouse position within the view.

setLayoutView

Sets the current layout view to synchronize the ruler with.

setSceneTransform

Sets the current scene transform.

sharedPainter

showEvent

tabletEvent

timerEvent

updateMicroFocus

wheelEvent

Signals

cursorPosChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

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

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.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_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], PyQt5.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: 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)