QgsProcessingParameterMatrix class
A table (matrix) parameter for processing algorithms.
Contents
Base classes
- class QgsProcessingParameterDefinition
- Base class for the definition of processing parameters.
Public static functions
- static auto fromScriptCode(const QString& name, const QString& description, bool isOptional, const QString& definition) -> QgsProcessingParameterMatrix*
- Creates a new parameter using the definition from a script code.
- static auto typeName() -> QString
- Returns the type name for the parameter class.
Constructors, destructors, conversion operators
- QgsProcessingParameterMatrix(const QString& name, const QString& description = QString(), int numberRows = 3, bool hasFixedNumberRows = false, const QStringList& headers = QStringList(), const QVariant& defaultValue = QVariant(), bool optional = false)
- Constructor for QgsProcessingParameterMatrix.
Public functions
- auto checkValueIsAcceptable(const QVariant& input, QgsProcessingContext* context = nullptr) const -> bool override
- Checks whether the specified input value is acceptable for the parameter.
- auto clone() const -> QgsProcessingParameterDefinition* override
- Creates a clone of the parameter definition.
- auto fromVariantMap(const QVariantMap& map) -> bool override
- Restores this parameter to a QVariantMap.
- auto hasFixedNumberRows() const -> bool
- Returns whether the table has a fixed number of rows.
- auto headers() const -> QStringList
- Returns a list of column headers (if set).
- auto numberRows() const -> int
- Returns the fixed number of rows in the table.
- void setHasFixedNumberRows(bool hasFixedNumberRows)
- Sets whether the table has a fixed number of rows.
- void setHeaders(const QStringList& headers)
- Sets the list of column headers.
- void setNumberRows(int rows)
- Sets the fixed number of rows in the table.
- auto toVariantMap() const -> QVariantMap override
- Saves this parameter to a QVariantMap.
- auto type() const -> QString override
- Unique parameter type name.
- auto valueAsPythonString(const QVariant& value, QgsProcessingContext& context) const -> QString override
- Returns a string version of the parameter input value, which is suitable for use as an input parameter value when running an algorithm directly from a Python command.
Function documentation
bool QgsProcessingParameterMatrix:: checkValueIsAcceptable(const QVariant& input,
QgsProcessingContext* context = nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
Returns true if the value can be accepted. The optional context parameter can be specified to allow a more stringent check to be performed, capable of checking for the presence of required layers and other factors within the context.
bool QgsProcessingParameterMatrix:: fromVariantMap(const QVariantMap& map) override
Restores this parameter to a QVariantMap.
Subclasses should ensure that they call the base class method.
bool QgsProcessingParameterMatrix:: hasFixedNumberRows() const
Returns whether the table has a fixed number of rows.
QStringList QgsProcessingParameterMatrix:: headers() const
Returns a list of column headers (if set).
int QgsProcessingParameterMatrix:: numberRows() const
Returns the fixed number of rows in the table.
This parameter only has an effect if hasFixedNumberRows() is true.
void QgsProcessingParameterMatrix:: setHasFixedNumberRows(bool hasFixedNumberRows)
Sets whether the table has a fixed number of rows.
void QgsProcessingParameterMatrix:: setHeaders(const QStringList& headers)
Sets the list of column headers.
void QgsProcessingParameterMatrix:: setNumberRows(int rows)
Sets the fixed number of rows in the table.
This parameter only has an effect if hasFixedNumberRows() is true.
QVariantMap QgsProcessingParameterMatrix:: toVariantMap() const override
Saves this parameter to a QVariantMap.
Subclasses should ensure that they call the base class method and then extend the result with additional properties.
QString QgsProcessingParameterMatrix:: valueAsPythonString(const QVariant& value,
QgsProcessingContext& context) const override
Returns a string version of the parameter input value, which is suitable for use as an input parameter value when running an algorithm directly from a Python command.
The returned value must be correctly escaped - e.g. string values must be wrapped in ' 's.