-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsmodelcomponentgraphicitem.h
171 lines (138 loc) · 5.47 KB
/
qgsmodelcomponentgraphicitem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/***************************************************************************
qgsmodelcomponentgraphicitem.h
----------------------------------
Date : March 2020
Copyright : (C) 2020 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 QGSMODELCOMPONENTGRAPHICITEM_H
#define QGSMODELCOMPONENTGRAPHICITEM_H
#include "qgis.h"
#include "qgis_gui.h"
#include <QGraphicsObject>
class QgsProcessingModelComponent;
class QgsProcessingModelParameter;
class QgsProcessingModelChildAlgorithm;
class QgsProcessingModelOutput;
class QgsProcessingModelAlgorithm;
///@cond NOT_STABLE
/**
* \ingroup gui
* \brief Base class for graphic items representing model components in the model designer.
* \warning Not stable API
* \since QGIS 3.14
*/
class GUI_EXPORT QgsModelComponentGraphicItem : public QGraphicsObject
{
Q_OBJECT
public:
/**
* Constructor for QgsModelComponentGraphicItem for the specified \a component, with the specified \a parent item.
*
* The \a model argument specifies the associated processing model. Ownership of \a model is not transferred, and
* it must exist for the lifetime of this object.
*
* Ownership of \a component is transferred to the item.
*/
QgsModelComponentGraphicItem( QgsProcessingModelComponent *component SIP_TRANSFER,
QgsProcessingModelAlgorithm *model,
QGraphicsItem *parent SIP_TRANSFERTHIS );
/**
* Returns the model component associated with this item.
*/
QgsProcessingModelComponent *component();
/**
* Returns the model associated with this item.
*/
QgsProcessingModelAlgorithm *model();
signals:
// TEMPORARY ONLY during refactoring
/**
* Emitted by the item to request a repaint of the parent model scene.
*/
void requestModelRepaint();
// TEMPORARY ONLY during refactoring
/**
* Emitted when the definition of the associated component is changed
* by the item.
*/
void changed();
private:
std::unique_ptr< QgsProcessingModelComponent > mComponent;
QgsProcessingModelAlgorithm *mModel = nullptr;
};
/**
* \ingroup gui
* \brief A graphic item representing a model parameter (input) in the model designer.
* \warning Not stable API
* \since QGIS 3.14
*/
class GUI_EXPORT QgsModelParameterGraphicItem : public QgsModelComponentGraphicItem
{
Q_OBJECT
public:
/**
* Constructor for QgsModelParameterGraphicItem for the specified \a parameter, with the specified \a parent item.
*
* The \a model argument specifies the associated processing model. Ownership of \a model is not transferred, and
* it must exist for the lifetime of this object.
*
* Ownership of \a parameter is transferred to the item.
*/
QgsModelParameterGraphicItem( QgsProcessingModelParameter *parameter SIP_TRANSFER,
QgsProcessingModelAlgorithm *model,
QGraphicsItem *parent SIP_TRANSFERTHIS );
};
/**
* \ingroup gui
* \brief A graphic item representing a child algorithm in the model designer.
* \warning Not stable API
* \since QGIS 3.14
*/
class GUI_EXPORT QgsModelChildAlgorithmGraphicItem : public QgsModelComponentGraphicItem
{
Q_OBJECT
public:
/**
* Constructor for QgsModelChildAlgorithmGraphicItem for the specified \a child, with the specified \a parent item.
*
* The \a model argument specifies the associated processing model. Ownership of \a model is not transferred, and
* it must exist for the lifetime of this object.
*
* Ownership of \a child is transferred to the item.
*/
QgsModelChildAlgorithmGraphicItem( QgsProcessingModelChildAlgorithm *child SIP_TRANSFER,
QgsProcessingModelAlgorithm *model,
QGraphicsItem *parent SIP_TRANSFERTHIS );
};
/**
* \ingroup gui
* \brief A graphic item representing a model output in the model designer.
* \warning Not stable API
* \since QGIS 3.14
*/
class GUI_EXPORT QgsModelOutputGraphicItem : public QgsModelComponentGraphicItem
{
Q_OBJECT
public:
/**
* Constructor for QgsModelOutputGraphicItem for the specified \a output, with the specified \a parent item.
*
* The \a model argument specifies the associated processing model. Ownership of \a model is not transferred, and
* it must exist for the lifetime of this object.
*
* Ownership of \a output is transferred to the item.
*/
QgsModelOutputGraphicItem( QgsProcessingModelOutput *output SIP_TRANSFER,
QgsProcessingModelAlgorithm *model,
QGraphicsItem *parent SIP_TRANSFERTHIS );
};
///@endcond
#endif // QGSMODELCOMPONENTGRAPHICITEM_H