QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
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
35class CORE_EXPORT QgsProcessingModelComponent
36{
37 public:
38
39 virtual ~QgsProcessingModelComponent() = default;
40
45 QString description() const;
46
51 void setDescription( const QString &description );
52
57 QPointF position() const;
58
63 void setPosition( QPointF position );
64
70 QSizeF size() const;
71
77 void setSize( QSizeF size );
78
87 QColor color() const;
88
96 void setColor( const QColor &color );
97
102 bool linksCollapsed( Qt::Edge edge ) const;
103
109 void setLinksCollapsed( Qt::Edge edge, bool collapsed );
110
115 SIP_SKIP virtual const QgsProcessingModelComment *comment() const { return nullptr; }
116
121 virtual QgsProcessingModelComment *comment() { return nullptr; }
122
127 virtual void setComment( const QgsProcessingModelComment &comment );
128
134 virtual QgsProcessingModelComponent *clone() const = 0 SIP_FACTORY;
135
136 protected:
137
139 QgsProcessingModelComponent( const QString &description = QString() );
140
142 QgsProcessingModelComponent( const QgsProcessingModelComponent &other ) = default;
143
145 QgsProcessingModelComponent &operator=( const QgsProcessingModelComponent &other ) = default;
146
151 void saveCommonProperties( QVariantMap &map ) const;
152
157 void restoreCommonProperties( const QVariantMap &map );
158
167 void copyNonDefinitionProperties( const QgsProcessingModelComponent &other );
168
169 private:
170
171 static constexpr double DEFAULT_COMPONENT_WIDTH = 200;
172 static constexpr double DEFAULT_COMPONENT_HEIGHT = 30;
173
175 QPointF mPosition;
176
177 QString mDescription;
178
179 QSizeF mSize = QSizeF( DEFAULT_COMPONENT_WIDTH, DEFAULT_COMPONENT_HEIGHT );
180 QColor mColor;
181
182 bool mTopEdgeLinksCollapsed = true;
183 bool mBottomEdgeLinksCollapsed = true;
184
185};
186
188
189#endif // QGSPROCESSINGMODELCOMPONENT_H
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_FACTORY
Definition qgis_sip.h:76