Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add shell for non-functional layout select tool
- Loading branch information
1 parent
4b89f5e
commit 4065a7f
Showing
8 changed files
with
212 additions
and
1 deletion.
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,45 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/layout/qgslayoutviewtoolselect.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
class QgsLayoutViewToolSelect : QgsLayoutViewTool | ||
{ | ||
%Docstring | ||
Layout view tool for selecting items in the layout. | ||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgslayoutviewtoolselect.h" | ||
%End | ||
public: | ||
|
||
QgsLayoutViewToolSelect( QgsLayoutView *view ); | ||
%Docstring | ||
Constructor for QgsLayoutViewToolSelect. | ||
%End | ||
|
||
virtual void layoutPressEvent( QgsLayoutViewMouseEvent *event ); | ||
|
||
virtual void layoutMoveEvent( QgsLayoutViewMouseEvent *event ); | ||
|
||
virtual void layoutReleaseEvent( QgsLayoutViewMouseEvent *event ); | ||
|
||
virtual void deactivate(); | ||
|
||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/layout/qgslayoutviewtoolselect.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/*************************************************************************** | ||
qgslayoutviewtoolselect.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 "qgslayoutviewtoolselect.h" | ||
#include "qgslayoutviewmouseevent.h" | ||
#include "qgslayoutview.h" | ||
|
||
QgsLayoutViewToolSelect::QgsLayoutViewToolSelect( QgsLayoutView *view ) | ||
: QgsLayoutViewTool( view, tr( "Select" ) ) | ||
{ | ||
setCursor( Qt::ArrowCursor ); | ||
|
||
mRubberBand.reset( new QgsLayoutViewRectangularRubberBand( view ) ); | ||
mRubberBand->setBrush( QBrush( QColor( 224, 178, 76, 63 ) ) ); | ||
mRubberBand->setPen( QPen( QBrush( QColor( 254, 58, 29, 100 ) ), 0, Qt::DotLine ) ); | ||
} | ||
|
||
void QgsLayoutViewToolSelect::layoutPressEvent( QgsLayoutViewMouseEvent *event ) | ||
{ | ||
if ( event->button() != Qt::LeftButton ) | ||
{ | ||
event->ignore(); | ||
return; | ||
} | ||
|
||
mIsSelecting = true; | ||
mMousePressStartPos = event->pos(); | ||
mRubberBand->start( event->layoutPoint(), 0 ); | ||
} | ||
|
||
void QgsLayoutViewToolSelect::layoutMoveEvent( QgsLayoutViewMouseEvent *event ) | ||
{ | ||
if ( mIsSelecting ) | ||
{ | ||
mRubberBand->update( event->layoutPoint(), 0 ); | ||
} | ||
else | ||
{ | ||
event->ignore(); | ||
} | ||
} | ||
|
||
void QgsLayoutViewToolSelect::layoutReleaseEvent( QgsLayoutViewMouseEvent *event ) | ||
{ | ||
if ( !mIsSelecting || event->button() != Qt::LeftButton ) | ||
{ | ||
event->ignore(); | ||
return; | ||
} | ||
|
||
mIsSelecting = false; | ||
QRectF rect = mRubberBand->finish( event->layoutPoint(), event->modifiers() ); | ||
Q_UNUSED( rect ); | ||
} | ||
|
||
void QgsLayoutViewToolSelect::deactivate() | ||
{ | ||
if ( mIsSelecting ) | ||
{ | ||
mRubberBand->finish(); | ||
mIsSelecting = false; | ||
} | ||
QgsLayoutViewTool::deactivate(); | ||
} |
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,62 @@ | ||
/*************************************************************************** | ||
qgslayoutviewtoolselect.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 QGSLAYOUTVIEWTOOLSELECT_H | ||
#define QGSLAYOUTVIEWTOOLSELECT_H | ||
|
||
#include "qgis.h" | ||
#include "qgis_gui.h" | ||
#include "qgslayoutviewtool.h" | ||
#include "qgslayoutviewrubberband.h" | ||
#include <memory> | ||
|
||
/** | ||
* \ingroup gui | ||
* Layout view tool for selecting items in the layout. | ||
* \since QGIS 3.0 | ||
*/ | ||
class GUI_EXPORT QgsLayoutViewToolSelect : public QgsLayoutViewTool | ||
{ | ||
|
||
Q_OBJECT | ||
|
||
public: | ||
|
||
/** | ||
* Constructor for QgsLayoutViewToolSelect. | ||
*/ | ||
QgsLayoutViewToolSelect( QgsLayoutView *view ); | ||
|
||
void layoutPressEvent( QgsLayoutViewMouseEvent *event ) override; | ||
void layoutMoveEvent( QgsLayoutViewMouseEvent *event ) override; | ||
void layoutReleaseEvent( QgsLayoutViewMouseEvent *event ) override; | ||
void deactivate() override; | ||
|
||
private: | ||
|
||
bool mIsSelecting = false; | ||
|
||
//! Rubber band item | ||
std::unique_ptr< QgsLayoutViewRubberBand > mRubberBand; | ||
|
||
//! Start position for mouse press | ||
QPoint mMousePressStartPos; | ||
|
||
//! Start of rubber band creation | ||
QPointF mRubberBandStartPos; | ||
|
||
}; | ||
|
||
#endif // QGSLAYOUTVIEWTOOLSELECT_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