QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsmodelviewtoolselect.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmodelviewtoolselect.h
3  -------------------------
4  Date : March 2020
5  Copyright : (C) 2020 Nyall Dawson
6 
7  Email : nyall dot dawson at gmail dot com
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef QGSMODELVIEWTOOLSELECT_H
18 #define QGSMODELVIEWTOOLSELECT_H
19 
20 #include "qgis_sip.h"
21 #include "qgis_gui.h"
22 #include "qgsmodelviewtool.h"
23 #include "qgsmodelviewrubberband.h"
24 #include <memory>
25 
26 class QgsModelViewMouseHandles;
27 class QGraphicsItem;
28 
29 #define SIP_NO_FILE
30 
36 class GUI_EXPORT QgsModelViewToolSelect : public QgsModelViewTool
37 {
38 
39  Q_OBJECT
40 
41  public:
42 
46  QgsModelViewToolSelect( QgsModelGraphicsView *view SIP_TRANSFERTHIS );
47  ~QgsModelViewToolSelect() override;
48 
49  void modelPressEvent( QgsModelViewMouseEvent *event ) override;
50  void modelMoveEvent( QgsModelViewMouseEvent *event ) override;
51  void modelDoubleClickEvent( QgsModelViewMouseEvent *event ) override;
52  void modelReleaseEvent( QgsModelViewMouseEvent *event ) override;
53  void wheelEvent( QWheelEvent *event ) override;
54  void keyPressEvent( QKeyEvent *event ) override;
55  void deactivate() override;
56  bool allowItemInteraction() override;
57 
61  QgsModelViewMouseHandles *mouseHandles();
62 
64  void setScene( QgsModelGraphicsScene *scene );
65 
69  void resetCache();
70 
71  private:
72 
73  bool mIsSelecting = false;
74 
76  std::unique_ptr< QgsModelViewRubberBand > mRubberBand;
77 
79  QPoint mMousePressStartPos;
80 
82  QPointF mRubberBandStartPos;
83 
84  QPointer< QgsModelViewMouseHandles > mMouseHandles; //owned by scene
85  QList< QGraphicsItem * > mHoverEnteredItems;
86 };
87 
88 #endif // QGSMODELVIEWTOOLSELECT_H
QgsModelViewToolSelect
Model designer view tool for selecting items in the model.
Definition: qgsmodelviewtoolselect.h:37
QgsModelViewMouseEvent
A QgsModelViewMouseEvent is the result of a user interaction with the mouse on a QgsModelGraphicsView...
Definition: qgsmodelviewmouseevent.h:37
QgsModelViewTool::deactivate
virtual void deactivate()
Called when tool is deactivated.
Definition: qgsmodelviewtool.cpp:130
QgsModelViewTool::modelPressEvent
virtual void modelPressEvent(QgsModelViewMouseEvent *event)
Mouse press event for overriding.
Definition: qgsmodelviewtool.cpp:75
QgsModelViewTool::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
Key press event for overriding.
Definition: qgsmodelviewtool.cpp:90
QgsModelViewTool::wheelEvent
virtual void wheelEvent(QWheelEvent *event)
Mouse wheel event for overriding.
Definition: qgsmodelviewtool.cpp:85
QgsModelViewTool::modelReleaseEvent
virtual void modelReleaseEvent(QgsModelViewMouseEvent *event)
Mouse release event for overriding.
Definition: qgsmodelviewtool.cpp:80
qgis_sip.h
QgsModelViewTool::allowItemInteraction
virtual bool allowItemInteraction()
Returns true if the tool allows interaction with component graphic items.
Definition: qgsmodelviewtool.cpp:100
QgsModelViewTool::modelMoveEvent
virtual void modelMoveEvent(QgsModelViewMouseEvent *event)
Mouse move event for overriding.
Definition: qgsmodelviewtool.cpp:65
QgsModelViewTool
Abstract base class for all model designer view tools.
Definition: qgsmodelviewtool.h:44
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
qgsmodelviewtool.h
QgsModelViewTool::modelDoubleClickEvent
virtual void modelDoubleClickEvent(QgsModelViewMouseEvent *event)
Mouse double-click event for overriding.
Definition: qgsmodelviewtool.cpp:70
qgsmodelviewrubberband.h