QGIS API Documentation  3.6.0-Noosa (5873452)
Public Member Functions | List of all members
QgsLayoutViewMouseEvent Class Reference

A QgsLayoutViewMouseEvent is the result of a user interaction with the mouse on a QgsLayoutView. More...

#include <qgslayoutviewmouseevent.h>

Inheritance diagram for QgsLayoutViewMouseEvent:
Inheritance graph
[legend]

Public Member Functions

 QgsLayoutViewMouseEvent (QgsLayoutView *view, QMouseEvent *event, bool snap=false)
 Constructor for QgsLayoutViewMouseEvent. More...
 
bool isSnapped () const
 Returns true if point was snapped, e.g. More...
 
QPointF layoutPoint () const
 Returns the event point location in layout coordinates. More...
 
QPointF snappedPoint () const
 Returns the snapped event point location in layout coordinates. More...
 
void snapPoint (QGraphicsLineItem *horizontalSnapLine=nullptr, QGraphicsLineItem *verticalSnapLine=nullptr, const QList< QgsLayoutItem *> &ignoreItems=QList< QgsLayoutItem * >())
 Manually triggers a snap for the mouse event position using the layout's snapper. More...
 

Detailed Description

A QgsLayoutViewMouseEvent is the result of a user interaction with the mouse on a QgsLayoutView.

It is sent whenever the user moves, clicks, releases or double clicks the mouse. In addition to the coordinates in pixel space it also knows the coordinates the layout space.

Since
QGIS 3.0

Definition at line 35 of file qgslayoutviewmouseevent.h.

Constructor & Destructor Documentation

◆ QgsLayoutViewMouseEvent()

QgsLayoutViewMouseEvent::QgsLayoutViewMouseEvent ( QgsLayoutView view,
QMouseEvent *  event,
bool  snap = false 
)

Constructor for QgsLayoutViewMouseEvent.

Should only be required to be called from the QgsLayoutView.

Parameters
viewThe view in which the event occurred.
eventThe original mouse event
snapset to true to snap the point using the layout's snapping settings

Definition at line 21 of file qgslayoutviewmouseevent.cpp.

Member Function Documentation

◆ isSnapped()

bool QgsLayoutViewMouseEvent::isSnapped ( ) const
inline

Returns true if point was snapped, e.g.

to grid or guide lines.

See also
snappedPoint()

Definition at line 84 of file qgslayoutviewmouseevent.h.

◆ layoutPoint()

QPointF QgsLayoutViewMouseEvent::layoutPoint ( ) const

Returns the event point location in layout coordinates.

Definition at line 44 of file qgslayoutviewmouseevent.cpp.

◆ snappedPoint()

QPointF QgsLayoutViewMouseEvent::snappedPoint ( ) const
inline

Returns the snapped event point location in layout coordinates.

The snapped point will consider all possible snapping methods, such as snapping to grid or guide lines.

See also
isSnapped()

Definition at line 78 of file qgslayoutviewmouseevent.h.

◆ snapPoint()

void QgsLayoutViewMouseEvent::snapPoint ( QGraphicsLineItem *  horizontalSnapLine = nullptr,
QGraphicsLineItem *  verticalSnapLine = nullptr,
const QList< QgsLayoutItem *> &  ignoreItems = QList< QgsLayoutItem * >() 
)

Manually triggers a snap for the mouse event position using the layout's snapper.

If the horizontalSnapLine and verticalSnapLine arguments are specified, then the snapper will automatically display and position these lines to indicate snapping positions to item bounds.

The ignoreItems argument can be used to specify a list of items to avoid snapping to.

Definition at line 36 of file qgslayoutviewmouseevent.cpp.


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