QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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:
45 QgsModelViewToolLink( QgsModelGraphicsView *view SIP_TRANSFERTHIS );
46
47 void modelMoveEvent( QgsModelViewMouseEvent *event ) override;
48 void modelReleaseEvent( QgsModelViewMouseEvent *event ) override;
49 bool allowItemInteraction() override;
50 void activate() override;
51 void deactivate() override;
52
61 void setFromSocket( QgsModelDesignerSocketGraphicItem *socket );
62
63 signals:
64
69
70 private:
71 std::unique_ptr<QgsModelViewBezierRubberBand> mBezierRubberBand;
72 QgsModelDesignerSocketGraphicItem *mFromSocket = nullptr;
73 QgsModelDesignerSocketGraphicItem *mToSocket = nullptr;
74
75 QgsModelDesignerSocketGraphicItem *mLastHoveredSocket = nullptr;
76
77 /* Used to return to select tool */
78 QPointer<QgsModelViewTool> mPreviousViewTool;
79
80 // These two are populated when clicking on an input socket that is already connected
81 // We use them to restore the connection when aborting, or to skip the undo step when the same input is selected
82 QString mPreviousInputChildId;
83 int mPreviousInputSocketNumber = -1;
84};
85#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