[PyQt] Examples of tying QML to Python objects
Louis Simons
lousimons at gmail.com
Sun Oct 23 23:45:42 BST 2016
I've been trying to fully understand everything at
http://pyqt.sourceforge.net/Docs/PyQt5/qml.html in tying QML to Python
objects, but I'm having trouble understanding how this would scale up to
non-trivial applications. I've been able to have a Python application
receive a function call from QML and other similarly basic tasks. However,
most tutorials I've read focus on manipulating QML properties via
javascript, with a passing mention that they can be bound to Python objects
for real-world applications. Does anyone know of any examples I could take
a look at where the data-model is entirely in Python, with QML acting as a
view and controller (or view-model, not sure I know the right relationship
yet).
As background, most of my GUI framework experience has been Ember.js
nested-component web applications. The big thing with Ember has been the
mantra "data-down, actions-up" where you build your GUI out of nested
components, passing data down through the parent-child relationships, and
the sub-components sending actions back up which manipulate the data
causing view changes. I've found it really nice for avoiding duplicate
getter/setter/callback code like I always seem to end up with in desktop
widgets-style applications. It seems like QML already is capable of this
concept by binding the highest QML object to a Python object which
represents all the data for the application. Then this highest QML object
instantiates QML subobjects, all of which can send events back to the top.
It's always entirely possible I'm way off, and I'm trying to square peg a
round hole, and would appreciate a pointer in the right direction.
Thanks,
Louis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20161023/0dcd7dab/attachment-0001.html>
More information about the PyQt
mailing list