QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgsprocessingmodelcomponent.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingmodelcomponent.h
3 -----------------------------
4 begin : June 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSPROCESSINGMODELCOMPONENT_H
19#define QGSPROCESSINGMODELCOMPONENT_H
20
21#include "qgis_core.h"
22#include "qgis.h"
23#include <QPointF>
24#include <QSizeF>
25#include <QColor>
26
27class QgsProcessingModelComment;
28
30
36class CORE_EXPORT QgsProcessingModelComponent
37{
38 public:
39
40 virtual ~QgsProcessingModelComponent() = default;
41
46 QString description() const;
47
52 void setDescription( const QString &description );
53
58 QPointF position() const;
59
64 void setPosition( QPointF position );
65
71 QSizeF size() const;
72
78 void setSize( QSizeF size );
79
88 QColor color() const;
89
97 void setColor( const QColor &color );
98
103 bool linksCollapsed( Qt::Edge edge ) const;
104
110 void setLinksCollapsed( Qt::Edge edge, bool collapsed );
111
116 SIP_SKIP virtual const QgsProcessingModelComment *comment() const { return nullptr; }
117
122 virtual QgsProcessingModelComment *comment() { return nullptr; }
123
128 virtual void setComment( const QgsProcessingModelComment &comment );
129
135 virtual QgsProcessingModelComponent *clone() const = 0 SIP_FACTORY;
136
137 protected:
138
140 QgsProcessingModelComponent( const QString &description = QString() );
141
143 QgsProcessingModelComponent( const QgsProcessingModelComponent &other ) = default;
144
146 QgsProcessingModelComponent &operator=( const QgsProcessingModelComponent &other ) = default;
147
152 void saveCommonProperties( QVariantMap &map ) const;
153
158 void restoreCommonProperties( const QVariantMap &map );
159
168 void copyNonDefinitionProperties( const QgsProcessingModelComponent &other );
169
170 private:
171
172 static constexpr double DEFAULT_COMPONENT_WIDTH = 200;
173 static constexpr double DEFAULT_COMPONENT_HEIGHT = 30;
174
176 QPointF mPosition;
177
178 QString mDescription;
179
180 QSizeF mSize = QSizeF( DEFAULT_COMPONENT_WIDTH, DEFAULT_COMPONENT_HEIGHT );
181 QColor mColor;
182
183 bool mTopEdgeLinksCollapsed = true;
184 bool mBottomEdgeLinksCollapsed = true;
185
186};
187
189
190#endif // QGSPROCESSINGMODELCOMPONENT_H
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_FACTORY
Definition: qgis_sip.h:76