[PyQt] Instantiate python qobject from qml

Fabian Sturm f at rtfs.org
Thu Jan 29 14:59:50 GMT 2015


Hello,

I still haven't really wrapped my head around qml and python qobjetcs  
and a model view separation. Here is what I want to do. E.g. I want to  
write an application to handle a list of contacts. The contacts are  
loaded from file into a python qobject. I also have a qml file to  
display a contact and a button "next" to show the next contact.

What I achieved so far is to write a python qobject which is imported  
and instantiated in the qml file that is loaded on demand. I can then  
also bind Labels to the qobject properties and call slots in the  
qobject for the prev and next button.

Next step would be to implement a real new and open menu entry. It  
should open a file dialog and instantiate a new qml/qobject whenever  
the user selects a new file.

Am I on the right track with this or is it meant to be used completely  
different?

Thanks,
Fabian

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: contacts.qml
Type: text/x-java
Size: 1231 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150129/ff53f769/attachment.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: contacts.py
Type: text/x-python
Size: 1131 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150129/ff53f769/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.qml
Type: text/x-java
Size: 675 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150129/ff53f769/attachment-0001.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.py
Type: text/x-python
Size: 817 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150129/ff53f769/attachment-0001.py>


More information about the PyQt mailing list