QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
layout
qgslayoutviewmouseevent.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgslayoutviewmouseevent.cpp
3
---------------------------
4
Date : July 2017
5
Copyright : (C) 2017 Nyall Dawson
6
Email : nyall dot dawson at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
17
#include "
qgslayoutviewmouseevent.h
"
18
19
#include "
qgslayout.h
"
20
#include "
qgslayoutview.h
"
21
22
QgsLayoutViewMouseEvent::QgsLayoutViewMouseEvent
(
QgsLayoutView
*view, QMouseEvent *event,
bool
snap )
23
: QMouseEvent( event->type(), event->pos(), event->button(), event->buttons(), event->modifiers() )
24
, mView( view )
25
{
26
mLayoutPoint = mView->mapToScene( x(), y() );
27
if
( snap && mView->currentLayout() )
28
{
29
mSnappedPoint = mView->currentLayout()->snapper().snapPoint( mLayoutPoint, mView->transform().m11(), mSnapped );
30
}
31
else
32
{
33
mSnappedPoint = mLayoutPoint;
34
}
35
}
36
37
void
QgsLayoutViewMouseEvent::snapPoint
( QGraphicsLineItem *horizontalSnapLine, QGraphicsLineItem *verticalSnapLine,
const
QList<QgsLayoutItem *> &excludeItems )
38
{
39
if
( mView->currentLayout() )
40
{
41
mSnappedPoint = mView->currentLayout()->snapper().snapPoint( mLayoutPoint, mView->transform().m11(), mSnapped, horizontalSnapLine, verticalSnapLine, &excludeItems );
42
}
43
}
44
45
QPointF
QgsLayoutViewMouseEvent::layoutPoint
()
const
46
{
47
return
mLayoutPoint;
48
}
QgsLayoutViewMouseEvent::snapPoint
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.
Definition
qgslayoutviewmouseevent.cpp:37
QgsLayoutViewMouseEvent::QgsLayoutViewMouseEvent
QgsLayoutViewMouseEvent(QgsLayoutView *view, QMouseEvent *event, bool snap=false)
Constructor for QgsLayoutViewMouseEvent.
Definition
qgslayoutviewmouseevent.cpp:22
QgsLayoutViewMouseEvent::layoutPoint
QPointF layoutPoint() const
Returns the event point location in layout coordinates.
Definition
qgslayoutviewmouseevent.cpp:45
QgsLayoutView
A graphical widget to display and interact with QgsLayouts.
Definition
qgslayoutview.h:52
qgslayout.h
qgslayoutview.h
qgslayoutviewmouseevent.h
Generated on
for QGIS API Documentation by
1.17.0