Skip to content
Permalink
Browse files

add missing QgsProcessingAlgorithm::parameterAsDateTime (#35003)

  • Loading branch information
3nids committed Mar 12, 2020
1 parent b510ad0 commit 3ccc3b815ac2d1bffe613f0d7191c0e010d68c63
@@ -875,6 +875,14 @@ Evaluates the parameter with matching ``name`` to a connection name string.
.. versionadded:: 3.14
%End

QDateTime parameterAsDateTime( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context );
%Docstring
Evaluates the parameter with matching ``name`` to a DateTime, or returns an invalid date time if the parameter was not set.

.. versionadded:: 3.14
%End


static QString invalidSourceError( const QVariantMap &parameters, const QString &name );
%Docstring
Returns a user-friendly string to use as an error when a source parameter could
@@ -3502,6 +3502,9 @@ class QgsProcessingParameterDateTime : QgsProcessingParameterDefinition
%Docstring
A datetime (or pure date or time) parameter for processing algorithms.

QgsProcessingParameterDateTime should be evaluated by calling QgsProcessingAlgorithm.parameterAsDateTime(),
which will return a date time value.

.. versionadded:: 3.14
%End

@@ -727,6 +727,11 @@ QString QgsProcessingAlgorithm::parameterAsConnectionName( const QVariantMap &pa
return QgsProcessingParameters::parameterAsConnectionName( parameterDefinition( name ), parameters, context );
}

QDateTime QgsProcessingAlgorithm::parameterAsDateTime( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context )
{
return QgsProcessingParameters::parameterAsDateTime( parameterDefinition( name ), parameters, context );
}

QString QgsProcessingAlgorithm::invalidSourceError( const QVariantMap &parameters, const QString &name )
{
if ( !parameters.contains( name ) )
@@ -862,6 +862,14 @@ class CORE_EXPORT QgsProcessingAlgorithm
*/
QString parameterAsConnectionName( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context );

/**
* Evaluates the parameter with matching \a name to a DateTime, or returns an invalid date time if the parameter was not set.
*
* \since QGIS 3.14
*/
QDateTime parameterAsDateTime( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context );


/**
* Returns a user-friendly string to use as an error when a source parameter could
* not be loaded.
@@ -3261,6 +3261,9 @@ class CORE_EXPORT QgsProcessingParameterMapTheme : public QgsProcessingParameter
* \ingroup core
* A datetime (or pure date or time) parameter for processing algorithms.
*
* QgsProcessingParameterDateTime should be evaluated by calling QgsProcessingAlgorithm::parameterAsDateTime(),
* which will return a date time value.
*
* * \since QGIS 3.14
*/
class CORE_EXPORT QgsProcessingParameterDateTime : public QgsProcessingParameterDefinition

0 comments on commit 3ccc3b8

Please sign in to comment.
You can’t perform that action at this time.