QGIS API Documentation 3.99.0-Master (c22de0620c0)
Loading...
Searching...
No Matches
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 <memory>
21
22#include "qgis_gui.h"
23#include "qgis_sip.h"
25#include "qgsmodelviewtool.h"
27
28#define SIP_NO_FILE
29
30class QgsModelViewMouseHandles;
31class QGraphicsItem;
32
33
40{
41 Q_OBJECT
42
43 public:
47 QgsModelViewToolSelect( QgsModelGraphicsView *view SIP_TRANSFERTHIS );
48 ~QgsModelViewToolSelect() override;
49
50 void modelPressEvent( QgsModelViewMouseEvent *event ) override;
51 void modelMoveEvent( QgsModelViewMouseEvent *event ) override;
52 void modelDoubleClickEvent( QgsModelViewMouseEvent *event ) override;
53 void modelReleaseEvent( QgsModelViewMouseEvent *event ) override;
54 void wheelEvent( QWheelEvent *event ) override;
55 void keyPressEvent( QKeyEvent *event ) override;
56 void deactivate() override;
57 bool allowItemInteraction() override;
58
62 QgsModelViewMouseHandles *mouseHandles();
63
65 void setScene( QgsModelGraphicsScene *scene );
66
70 void resetCache();
71
72 private:
73 bool mIsSelecting = false;
74
76 std::unique_ptr<QgsModelViewRubberBand> mRubberBand;
77
78 std::unique_ptr<QgsModelViewToolLink> mLinkTool = nullptr;
79
81 QPoint mMousePressStartPos;
82
84 QPointF mRubberBandStartPos;
85
86 QPointer<QgsModelViewMouseHandles> mMouseHandles; //owned by scene
87 QList<QGraphicsItem *> mHoverEnteredItems;
88};
89
90#endif // QGSMODELVIEWTOOLSELECT_H
A mouse event which is the result of a user interaction with a QgsModelGraphicsView.
void setScene(QgsModelGraphicsScene *scene)
Sets the a scene.
void resetCache()
Resets the internal cache following a scene change.
QgsModelViewMouseHandles * mouseHandles()
Returns the view's mouse handles.
QgsModelViewToolSelect(QgsModelGraphicsView *view)
Constructor for QgsModelViewToolSelect.
QgsModelGraphicsView * view() const
Returns the view associated with the tool.
virtual void modelDoubleClickEvent(QgsModelViewMouseEvent *event)
Mouse double-click event for overriding.
virtual void wheelEvent(QWheelEvent *event)
Mouse wheel event for overriding.
virtual void modelMoveEvent(QgsModelViewMouseEvent *event)
Mouse move event for overriding.
virtual bool allowItemInteraction()
Returns true if the tool allows interaction with component graphic items.
virtual void deactivate()
Called when tool is deactivated.
QgsModelViewTool(QgsModelGraphicsView *view, const QString &name)
Constructor for QgsModelViewTool, taking a model view and tool name as parameters.
virtual void modelPressEvent(QgsModelViewMouseEvent *event)
Mouse press event for overriding.
virtual void keyPressEvent(QKeyEvent *event)
Key press event for overriding.
virtual void modelReleaseEvent(QgsModelViewMouseEvent *event)
Mouse release event for overriding.
QgsModelGraphicsScene * scene() const
Returns the scene associated with the tool.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52