-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db62a74
commit 3f66520
Showing
9 changed files
with
210 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/layout/qgslayoutviewtoolpan.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
class QgsLayoutViewToolPan : QgsLayoutViewTool | ||
{ | ||
%Docstring | ||
Layout view tool for panning the layout. | ||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgslayoutviewtoolpan.h" | ||
%End | ||
public: | ||
|
||
QgsLayoutViewToolPan( QgsLayoutView *view ); | ||
%Docstring | ||
Constructor for QgsLayoutViewToolPan. | ||
%End | ||
|
||
virtual void layoutPressEvent( QgsLayoutViewMouseEvent *event ); | ||
|
||
virtual void layoutMoveEvent( QgsLayoutViewMouseEvent *event ); | ||
|
||
virtual void layoutReleaseEvent( QgsLayoutViewMouseEvent *event ); | ||
|
||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/layout/qgslayoutviewtoolpan.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/*************************************************************************** | ||
qgslayoutviewtoolpan.cpp | ||
------------------------ | ||
Date : July 2017 | ||
Copyright : (C) 2017 Nyall Dawson | ||
Email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgslayoutviewtoolpan.h" | ||
#include "qgslayoutviewmouseevent.h" | ||
#include "qgslayoutview.h" | ||
#include <QScrollBar> | ||
|
||
QgsLayoutViewToolPan::QgsLayoutViewToolPan( QgsLayoutView *view ) | ||
: QgsLayoutViewTool( view, tr( "Pan" ) ) | ||
{ | ||
setCursor( Qt::OpenHandCursor ); | ||
} | ||
|
||
void QgsLayoutViewToolPan::layoutPressEvent( QgsLayoutViewMouseEvent *event ) | ||
{ | ||
if ( event->button() != Qt::LeftButton ) | ||
{ | ||
return; | ||
} | ||
|
||
mIsPanning = true; | ||
mLastMousePos = event->pos(); | ||
view()->setCursor( Qt::ClosedHandCursor ); | ||
} | ||
|
||
void QgsLayoutViewToolPan::layoutMoveEvent( QgsLayoutViewMouseEvent *event ) | ||
{ | ||
if ( !mIsPanning ) | ||
return; | ||
|
||
view()->horizontalScrollBar()->setValue( view()->horizontalScrollBar()->value() - ( event->x() - mLastMousePos.x() ) ); | ||
view()->verticalScrollBar()->setValue( view()->verticalScrollBar()->value() - ( event->y() - mLastMousePos.y() ) ); | ||
mLastMousePos = event->pos(); | ||
} | ||
|
||
void QgsLayoutViewToolPan::layoutReleaseEvent( QgsLayoutViewMouseEvent *event ) | ||
{ | ||
if ( !mIsPanning || event->button() != Qt::LeftButton ) | ||
{ | ||
return; | ||
} | ||
|
||
mIsPanning = false; | ||
view()->setCursor( Qt::OpenHandCursor ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*************************************************************************** | ||
qgslayoutviewtoolpan.h | ||
---------------------- | ||
Date : July 2017 | ||
Copyright : (C) 2017 Nyall Dawson | ||
Email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSLAYOUTVIEWTOOLPAN_H | ||
#define QGSLAYOUTVIEWTOOLPAN_H | ||
|
||
#include "qgis.h" | ||
#include "qgis_gui.h" | ||
#include "qgslayoutviewtool.h" | ||
#include "qgslayoutviewrubberband.h" | ||
#include <memory> | ||
|
||
/** | ||
* \ingroup gui | ||
* Layout view tool for panning the layout. | ||
* \since QGIS 3.0 | ||
*/ | ||
class GUI_EXPORT QgsLayoutViewToolPan : public QgsLayoutViewTool | ||
{ | ||
|
||
Q_OBJECT | ||
|
||
public: | ||
|
||
/** | ||
* Constructor for QgsLayoutViewToolPan. | ||
*/ | ||
QgsLayoutViewToolPan( QgsLayoutView *view ); | ||
|
||
void layoutPressEvent( QgsLayoutViewMouseEvent *event ) override; | ||
void layoutMoveEvent( QgsLayoutViewMouseEvent *event ) override; | ||
void layoutReleaseEvent( QgsLayoutViewMouseEvent *event ) override; | ||
|
||
private: | ||
|
||
bool mIsPanning = false; | ||
QPoint mLastMousePos; | ||
|
||
}; | ||
|
||
#endif // QGSLAYOUTVIEWTOOLPAN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters