QgsLayoutRuler class
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.
Contents
Constructors, destructors, conversion operators
- QgsLayoutRuler(QWidget* parent = nullptr, Qt::Orientation orientation = Qt::Horizontal) explicit
- Constructor for QgsLayoutRuler, with the specified parent widget and orientation.
Public functions
- auto layoutView() -> QgsLayoutView*
- Returns the current layout view associated with the ruler.
- auto rulerSize() const -> int
- Returns the ruler size (either the height of a horizontal ruler or the width of a vertical rule).
- void setContextMenu(QMenu* menu)
- Sets a context menu to show when right clicking occurs on the ruler.
- void setLayoutView(QgsLayoutView* view)
- Sets the current layout view to synchronize the ruler with.
- void setSceneTransform(const QTransform& transform)
- Sets the current scene transform.
Signals
- void cursorPosChanged(QPointF)
- Is emitted when mouse cursor coordinates change.
Public slots
- void setCursorPosition(QPointF position)
- Updates the position of the marker showing the current mouse position within the view.
Function documentation
QgsLayoutView* QgsLayoutRuler:: layoutView()
Returns the current layout view associated with the ruler.
void QgsLayoutRuler:: setContextMenu(QMenu* menu)
Sets a context menu to show when right clicking occurs on the ruler.
Ownership of menu is unchanged.
void QgsLayoutRuler:: setLayoutView(QgsLayoutView* view)
Sets the current layout view to synchronize the ruler with.
void QgsLayoutRuler:: setSceneTransform(const QTransform& transform)
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.
void QgsLayoutRuler:: setCursorPosition(QPointF position) public slot
Updates the position of the marker showing the current mouse position within the view.
position is in layout coordinates.