Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional QgsProcessingParameterExpression defaults to field if input has one field #41063

Closed
uclaros opened this issue Jan 18, 2021 · 1 comment · Fixed by #41089
Closed

Optional QgsProcessingParameterExpression defaults to field if input has one field #41063

uclaros opened this issue Jan 18, 2021 · 1 comment · Fixed by #41089
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@uclaros
Copy link
Contributor

uclaros commented Jan 18, 2021

Describe the bug

A processing algorithm that uses an optional QgsProcessingParameterExpression defaults its value to input field if the input layer has one field only, instead of being left blank like when there are more fields or no fields.

How to Reproduce
Open a point layer that has a single field and load the c++ points to path algorithm. Both order expression and group expression defaults to the single field instead of being blank.

QGIS and OS versions
Master on debian testing

@uclaros uclaros added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jan 18, 2021
@nyalldawson
Copy link
Collaborator

Possibly a matter of just setting QgsFieldExpressionWidget::setAllowEmptyFieldName(true) in QgsProcessingExpressionWidgetWrapper::createWidget() for optional expressions

@gioman gioman added the Processing Relating to QGIS Processing framework or individual Processing algorithms label Jan 19, 2021
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Jan 19, 2021
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Jan 20, 2021
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Feb 19, 2021
nyalldawson added a commit that referenced this issue Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants