QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsLayoutRuler Class Reference

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. More...

#include <qgslayoutruler.h>

Inheritance diagram for QgsLayoutRuler:
Inheritance graph
[legend]

Public Slots

void setCursorPosition (QPointF position)
 Updates the position of the marker showing the current mouse position within the view. More...
 

Signals

void cursorPosChanged (QPointF)
 Emitted when mouse cursor coordinates change. More...
 

Public Member Functions

 QgsLayoutRuler (QWidget *parent=nullptr, Qt::Orientation orientation=Qt::Horizontal)
 Constructor for QgsLayoutRuler, with the specified parent widget and orientation. More...
 
QgsLayoutViewlayoutView ()
 Returns the current layout view associated with the ruler. More...
 
QSize minimumSizeHint () const override
 
int rulerSize () const
 Returns the ruler size (either the height of a horizontal ruler or the width of a vertical rule). More...
 
void setContextMenu (QMenu *menu)
 Sets a context menu to show when right clicking occurs on the ruler. More...
 
void setLayoutView (QgsLayoutView *view)
 Sets the current layout view to synchronize the ruler with. More...
 
void setSceneTransform (const QTransform &transform)
 Sets the current scene transform. More...
 

Protected Member Functions

void mouseMoveEvent (QMouseEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 

Detailed Description

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.

Since
QGIS 3.0

Definition at line 38 of file qgslayoutruler.h.

Constructor & Destructor Documentation

◆ QgsLayoutRuler()

QgsLayoutRuler::QgsLayoutRuler ( QWidget *  parent = nullptr,
Qt::Orientation  orientation = Qt::Horizontal 
)
explicit

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

Definition at line 33 of file qgslayoutruler.cpp.

Member Function Documentation

◆ cursorPosChanged

void QgsLayoutRuler::cursorPosChanged ( QPointF  )
signal

Emitted when mouse cursor coordinates change.

◆ layoutView()

QgsLayoutView* QgsLayoutRuler::layoutView ( )
inline

Returns the current layout view associated with the ruler.

See also
setLayoutView()

Definition at line 62 of file qgslayoutruler.h.

◆ minimumSizeHint()

QSize QgsLayoutRuler::minimumSizeHint ( ) const
override

Definition at line 75 of file qgslayoutruler.cpp.

◆ mouseMoveEvent()

void QgsLayoutRuler::mouseMoveEvent ( QMouseEvent *  event)
overrideprotected

Definition at line 582 of file qgslayoutruler.cpp.

◆ mousePressEvent()

void QgsLayoutRuler::mousePressEvent ( QMouseEvent *  event)
overrideprotected

Definition at line 687 of file qgslayoutruler.cpp.

◆ mouseReleaseEvent()

void QgsLayoutRuler::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected

Definition at line 718 of file qgslayoutruler.cpp.

◆ paintEvent()

void QgsLayoutRuler::paintEvent ( QPaintEvent *  event)
overrideprotected

Definition at line 80 of file qgslayoutruler.cpp.

◆ rulerSize()

int QgsLayoutRuler::rulerSize ( ) const
inline

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

Definition at line 74 of file qgslayoutruler.h.

◆ setContextMenu()

void QgsLayoutRuler::setContextMenu ( QMenu *  menu)

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

Ownership of menu is unchanged.

Definition at line 571 of file qgslayoutruler.cpp.

◆ setCursorPosition

void QgsLayoutRuler::setCursorPosition ( QPointF  position)
slot

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

position is in layout coordinates.

Definition at line 576 of file qgslayoutruler.cpp.

◆ setLayoutView()

void QgsLayoutRuler::setLayoutView ( QgsLayoutView view)

Sets the current layout view to synchronize the ruler with.

See also
layoutView()

Definition at line 565 of file qgslayoutruler.cpp.

◆ setSceneTransform()

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.

Definition at line 559 of file qgslayoutruler.cpp.


The documentation for this class was generated from the following files: