QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsmodelviewtoollink.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmodelviewtoollink.h
3 ----------------------------------
4 Date : January 2024
5 Copyright : (C) 2024 Valentin Buira
6 Email : valentin dot buira 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#ifndef QGSMODELVIEWTOOLLINK_H
17#define QGSMODELVIEWTOOLLINK_H
18
19#include <memory>
20
21#include "qgis_gui.h"
22#include "qgis_sip.h"
23#include "qgsmodelviewtool.h"
24
25#define SIP_NO_FILE
26
28class QgsModelDesignerSocketGraphicItem;
29class QgsProcessingModelComponent;
30
37class GUI_EXPORT QgsModelViewToolLink : public QgsModelViewTool
38{
39 Q_OBJECT
40
41 public:
42
46 QgsModelViewToolLink( QgsModelGraphicsView *view SIP_TRANSFERTHIS );
47
48 void modelMoveEvent( QgsModelViewMouseEvent *event ) override;
49 void modelReleaseEvent( QgsModelViewMouseEvent *event ) override;
50 bool allowItemInteraction() override;
51 void activate() override;
52 void deactivate() override;
53
62 void setFromSocket( QgsModelDesignerSocketGraphicItem *socket );
63
64 signals:
65
70
71 private:
72 std::unique_ptr<QgsModelViewBezierRubberBand> mBezierRubberBand;
73 QgsModelDesignerSocketGraphicItem *mFromSocket = nullptr;
74 QgsModelDesignerSocketGraphicItem *mToSocket = nullptr;
75
76 QgsModelDesignerSocketGraphicItem *mLastHoveredSocket = nullptr;
77
78 /* Used to return to select tool */
79 QPointer<QgsModelViewTool> mPreviousViewTool;
80
81 // These two are populated when clicking on an input socket that is already connected
82 // We use them to restore the connection when aborting, or to skip the undo step when the same input is selected
83 QString mPreviousInputChildId;
84 int mPreviousInputSocketNumber = -1;
85};
86#endif // QGSMODELVIEWTOOLLINK_H
A bezier curve rubber band for use within QgsModelGraphicsView widgets.
A mouse event which is the result of a user interaction with a QgsModelGraphicsView.
QgsModelGraphicsView * view() const
Returns the view associated with the tool.
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 activate()
Called when tool is set as the currently active model tool.
virtual void modelReleaseEvent(QgsModelViewMouseEvent *event)
Mouse release event for overriding.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53