[PyQt] future of (py)qt desktop

martin kolman martin.kolman at gmail.com
Thu Jan 7 12:15:14 GMT 2016


2016-01-06 16:29 GMT+01:00 Dietmar Schwertberger <maillist at schwertberger.de>
:

> On 06.01.2016 15:46, Phil Thompson wrote:
>
>> I have experimented with ways of eliminating the need for QML. The main
>> problem is that the internal architecture of QML/Quick etc is, let's say,
>> not state of the art. (In the Trolltech days they never would have released
>> something so badly designed.)
>>
>> QML is fine for what it does - which isn't very much. I would treat it
>> just as a way of creating GUIs (ie. implement views in QML, but implement
>> models and controllers in Python). While you can implement lots more in QML
>> I wouldn't recommend it because it's not easy to re-use or extend code or
>> to manage large amounts of code.
>>
> Yes, for pure markup QML would be OK.
> It would help a lot if it would be possible to just define the basic GUI
> in QML, but connect events, fill the widgets etc. from Python without all
> the JavaScript mess.
> E.g.
> self.GUI = qt.load("GUI.qml")
> self.GUI.windows["Main"].widgets["Play"].connect(self.OnPlay)
> self.GUI.windows["Main"].widgets["list"].fill( ["Title 1", "Title 2"] ) #
> for a short list, otherwise use MVC
>
> def OnPlay(self, event):
>     track_index = self.GUI.forms["Main"].widgets["list"].getIndex()
>

You can kinda do that in PyOtherSide - but the other way around. You write
the "backend" code in Python and then import and call it from QML. See the
PyOtherSide examples[0], such as the notes one[1][2] as an example.

Also recently support for working with QObjects passed from QML to Python
has been added - which sounds kinda like the thing you propose. An example
from the docs[3]:

# Assume func will be called with a QObject as sole argumentdef func(qobject):
    # Getting properties
    print(qobject.x)

    # Setting properties
    qobject.x = 123

    # Calling slots and dynamic functions
    print(qobject.someFunction(123, 'b'))

    # Returning a QObject reference to the caller
    return qobject


> Currently, Qt Quick is a no-go for me. I had a close look and I don't like
> it...
>
> Regards,
>
> Dietmar
>
> [0] https://github.com/thp/pyotherside/tree/master/examples
[1] https://github.com/thp/pyotherside/blob/master/examples/notes_example.py
[2]
https://github.com/thp/pyotherside/blob/master/examples/notes_example.qml
[3]
http://pyotherside.readthedocs.org/en/latest/#accessing-qobjects-from-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160107/6f5a4234/attachment.html>


More information about the PyQt mailing list