Skip to content

Commit 1fea03f

Browse files
committedJul 31, 2018
[processing] Make model to/from variant methods public
1 parent 01bf140 commit 1fea03f

File tree

2 files changed

+38
-16
lines changed

2 files changed

+38
-16
lines changed
 

‎python/core/auto_generated/processing/models/qgsprocessingmodelalgorithm.sip.in

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,26 @@ Writes the model to a file, at the specified ``path``.
291291
Reads the model from a file, at the specified ``path``.
292292

293293
.. seealso:: :py:func:`toFile`
294+
%End
295+
296+
QVariant toVariant() const;
297+
%Docstring
298+
Saves this model to a QVariantMap, wrapped in a QVariant.
299+
You can use QgsXmlUtils.writeVariant to save it to an XML document.
300+
301+
.. seealso:: :py:func:`loadVariant`
302+
303+
.. versionadded:: 3.4
304+
%End
305+
306+
bool loadVariant( const QVariant &variant );
307+
%Docstring
308+
Loads this model from a QVariantMap, wrapped in a QVariant ``variant``.
309+
You can use QgsXmlUtils.readVariant to load it from an XML document.
310+
311+
.. seealso:: :py:func:`toVariant`
312+
313+
.. versionadded:: 3.4
294314
%End
295315

296316
QVariantMap &helpContent();

‎src/core/processing/models/qgsprocessingmodelalgorithm.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,24 @@ class CORE_EXPORT QgsProcessingModelAlgorithm : public QgsProcessingAlgorithm
251251
*/
252252
bool fromFile( const QString &path );
253253

254+
/**
255+
* Saves this model to a QVariantMap, wrapped in a QVariant.
256+
* You can use QgsXmlUtils::writeVariant to save it to an XML document.
257+
*
258+
* \see loadVariant()
259+
* \since QGIS 3.4
260+
*/
261+
QVariant toVariant() const;
262+
263+
/**
264+
* Loads this model from a QVariantMap, wrapped in a QVariant \a variant.
265+
* You can use QgsXmlUtils::readVariant to load it from an XML document.
266+
*
267+
* \see toVariant()
268+
* \since QGIS 3.4
269+
*/
270+
bool loadVariant( const QVariant &variant );
271+
254272
/**
255273
* Returns the model's help contents (a free-form map of values describing the algorithm's
256274
* use and metadata).
@@ -387,22 +405,6 @@ class CORE_EXPORT QgsProcessingModelAlgorithm : public QgsProcessingAlgorithm
387405
*/
388406
bool childOutputIsRequired( const QString &childId, const QString &outputName ) const;
389407

390-
/**
391-
* Saves this model to a QVariantMap, wrapped in a QVariant.
392-
* You can use QgsXmlUtils::writeVariant to save it to an XML document.
393-
*
394-
* \see loadVariant()
395-
*/
396-
QVariant toVariant() const;
397-
398-
/**
399-
* Loads this model from a QVariantMap, wrapped in a QVariant.
400-
* You can use QgsXmlUtils::readVariant to load it from an XML document.
401-
*
402-
* \see toVariant()
403-
*/
404-
bool loadVariant( const QVariant &model );
405-
406408
/**
407409
* Checks whether the output vector type given by \a outputType is compatible
408410
* with the list of acceptable data types specified by \a acceptableDataTypes.

0 commit comments

Comments
 (0)
Please sign in to comment.