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

Expression preview widget: do not disable feature picker (fixes #38646) #38797

Merged
merged 1 commit into from
Sep 16, 2020

Conversation

rouault
Copy link
Contributor

@rouault rouault commented Sep 16, 2020

In the text edit of the feature picker, if one currently enters an invalid value,
the whole feature picker becomes disabled, which requires to close and re-open
the expression string builder dialog.

So instead of doing this, use the preview label to indicate that a valid
feature is needed to evaluate the expression, for expressions that require feature
fields.

Previous related pull requests are:
#37518
#37139

…38646)

In the text edit of the feature picker, if one currently enters an invalid value,
the whole feature picker becomes disabled, which requires to close and re-open
the expression string builder dialog.

So instead of doing this, use the preview label to indicate that a valid
feature is needed to evaluate the expression, for expressions that require feature
fields.

Previous related pull requests are:
qgis#37518
qgis#37139
@rouault rouault added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Sep 16, 2020
@rouault rouault requested a review from 3nids September 16, 2020 09:23
@github-actions github-actions bot added this to the 3.16.0 milestone Sep 16, 2020
if ( !feature.isValid() )
{
QgsFeature validFeature( feature );
validFeature.setValid( true );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you remove this, that will bring back the issue when a layer is empty and you try an expression (#37100).
Or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this pull request, if the layer is empty (or you specify an invalid FID),

  • if the expression doesn't use fields, then it is evaluated
  • if the expression uses fields, the preview label displays "No feature was found on this layer to evaluate the expression" (not that the expression is invalid)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, that makes sense.

@nyalldawson nyalldawson merged commit ecc8405 into qgis:master Sep 16, 2020
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!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants