QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
layout
qgslayoutviewtooltemporarykeypan.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgslayoutviewtooltemporarykeypan.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
#include "
qgslayoutviewtooltemporarykeypan.h
"
17
18
#include "
qgslayoutview.h
"
19
#include "
qgslayoutviewmouseevent.h
"
20
21
#include <QScrollBar>
22
23
#include "moc_qgslayoutviewtooltemporarykeypan.cpp"
24
25
QgsLayoutViewToolTemporaryKeyPan::QgsLayoutViewToolTemporaryKeyPan
(
QgsLayoutView
*
view
)
26
:
QgsLayoutViewTool
(
view
, tr(
"Pan"
) )
27
{
28
setCursor
( Qt::ClosedHandCursor );
29
}
30
31
void
QgsLayoutViewToolTemporaryKeyPan::layoutMoveEvent
(
QgsLayoutViewMouseEvent
*event )
32
{
33
view
()->horizontalScrollBar()->setValue(
view
()->horizontalScrollBar()->value() - ( event->x() - mLastMousePos.x() ) );
34
view
()->verticalScrollBar()->setValue(
view
()->verticalScrollBar()->value() - ( event->y() - mLastMousePos.y() ) );
35
mLastMousePos =
event
->pos();
36
view
()->
viewChanged
();
37
}
38
39
void
QgsLayoutViewToolTemporaryKeyPan::keyReleaseEvent
( QKeyEvent *event )
40
{
41
if
( event->key() == Qt::Key_Space && !event->isAutoRepeat() )
42
{
43
view
()->
setTool
( mPreviousViewTool );
44
}
45
}
46
47
void
QgsLayoutViewToolTemporaryKeyPan::activate
()
48
{
49
mLastMousePos =
view
()->mapFromGlobal( QCursor::pos() );
50
mPreviousViewTool =
view
()->
tool
();
51
QgsLayoutViewTool::activate
();
52
}
QgsLayoutViewMouseEvent
A mouse event which is the result of a user interaction with a QgsLayoutView.
Definition
qgslayoutviewmouseevent.h:35
QgsLayoutViewToolTemporaryKeyPan::keyReleaseEvent
void keyReleaseEvent(QKeyEvent *event) override
Key release event for overriding.
Definition
qgslayoutviewtooltemporarykeypan.cpp:39
QgsLayoutViewToolTemporaryKeyPan::QgsLayoutViewToolTemporaryKeyPan
QgsLayoutViewToolTemporaryKeyPan(QgsLayoutView *view)
Constructor for QgsLayoutViewToolTemporaryKeyPan.
Definition
qgslayoutviewtooltemporarykeypan.cpp:25
QgsLayoutViewToolTemporaryKeyPan::layoutMoveEvent
void layoutMoveEvent(QgsLayoutViewMouseEvent *event) override
Mouse move event for overriding.
Definition
qgslayoutviewtooltemporarykeypan.cpp:31
QgsLayoutViewToolTemporaryKeyPan::activate
void activate() override
Called when tool is set as the currently active layout tool.
Definition
qgslayoutviewtooltemporarykeypan.cpp:47
QgsLayoutViewTool::setCursor
void setCursor(const QCursor &cursor)
Sets a user defined cursor for use when the tool is active.
Definition
qgslayoutviewtool.cpp:114
QgsLayoutViewTool::view
QgsLayoutView * view() const
Returns the view associated with the tool.
Definition
qgslayoutviewtool.cpp:38
QgsLayoutViewTool::activate
virtual void activate()
Called when tool is set as the currently active layout tool.
Definition
qgslayoutviewtool.cpp:119
QgsLayoutViewTool::QgsLayoutViewTool
QgsLayoutViewTool(QgsLayoutView *view, const QString &name)
Constructor for QgsLayoutViewTool, taking a layout view and tool name as parameters.
Definition
qgslayoutviewtool.cpp:23
QgsLayoutView
A graphical widget to display and interact with QgsLayouts.
Definition
qgslayoutview.h:52
QgsLayoutView::viewChanged
void viewChanged()
Updates associated rulers and other widgets after view extent or zoom has changed.
Definition
qgslayoutview.cpp:1182
QgsLayoutView::setTool
void setTool(QgsLayoutViewTool *tool)
Sets the tool currently being used in the view.
Definition
qgslayoutview.cpp:140
QgsLayoutView::tool
QgsLayoutViewTool * tool
Definition
qgslayoutview.h:65
qgslayoutview.h
qgslayoutviewmouseevent.h
qgslayoutviewtooltemporarykeypan.h
Generated on
for QGIS API Documentation by
1.17.0