-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
QField 💖 QML & HTML #1221
QField 💖 QML & HTML #1221
Conversation
src/core/featuremodel.cpp
Outdated
@@ -49,7 +49,7 @@ FeatureModel::ModelModes FeatureModel::modelMode() const | |||
|
|||
void FeatureModel::setFeature( const QgsFeature &feature ) | |||
{ | |||
if ( mModelMode != SingleFeatureModel || mFeature == feature ) | |||
if ( mModelMode != SingleFeatureModel ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To trigger a refresh when the feature is modified. If you look into FeatureModel::save(), you'll see it calls setFeature( modifiedFeature ), which ended up doing nothing as mFeature == modifiedFeature will be true even if the modifiedFeature has different attribute values et al.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it worth adding a bool force = false
argument to the method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Na, I've seen other weird behaviors which is fixed by this removed check. So I'd prefer just removing it all together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as mFeature == modifiedFeature will be true even if the modifiedFeature has different attribute values et al.
According to QgsFeatore::operator==
attributes should be compared as well. What did I miss?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so no.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/qgis/QGIS/blob/master/src/core/qgsfeature.cpp#L68
I am no expert, but I would like to avoid having setters being executed too many times. It makes the debugging more difficult and might be noticeable by the user (rendering time, flickering).
but that's not my call to make here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll adjust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@3nids , done.
@m-kuhn , I think we might have a bit of work to do on the osgeo4a side of things to add the QML WebView module. |
@m-kuhn , I suspect a similar update will be required for QML charts module too. See how the QML chart widget is missing when testing on my smartphone: |
f739e28
to
0f031eb
Compare
@m-kuhn , this is all green and ready to approve. |
This PR implements QML widget support in the feature form. An obligatory GIF:
As the above screencast demonstrates, the current implementation QField supports expression.evaluate(...). The method I've settled on to do it (i.e. string substitution in the QML source string) was the most appropriate solution I could come up with. On the plus side, the general idea behind it can easily be used to come up with an HTML widget support (via the WebView item).