In QAbstractItemModel, whenever the data changes, a signal is emitted that
we can listen to. E.g. when a particular field changes, the QTreeView or
what have you re-draws to reflect this.
With web-applications, this doesn’t seem to be the case. Using MongoDB for
instance, interacting with the model (database) typically (seems to)
include an additional interaction with an event (however I’m very new to
it).
# Exampledef update_field(content):
field.setText(content) # Update visually
database.insert({"key": value}, content) # Update model
Firebase on the other hand looks more like QAbstractItemModel, in that for
each change there is an event.
https://www.firebase.com/docs/web/api/query/on.html
firebaseRef.on('value', function(dataSnapshot) {
// Model was updated
field.setText(dataSnapShot.val())
});
It may be due to familiarity, but it seems more intuitive to me to listen
for changes on a model, than to double-up on updating both views and models
from a controller when it comes to changes to data.
Are there other databases that does this, that isn’t cloud-based? Is this a
common practice? Why not?
Best,
Marcus
--
*Marcus Ottosson*
[email protected]
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOALCSxNB%2B3ZbLLLrk7_%3DjQY2nRQDiqt%3DL7X%3Dz9XBLYZAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.