[PyQt] future of (py)qt desktop

Mathias.Born at gmx.de Mathias.Born at gmx.de
Wed Jan 6 18:26:47 GMT 2016


On 06.01.2016, 16:29:28 Dietmar Schwertberger wrote:
> 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 easily do that. For example, using qtquick controls:

=== QML ===
Button {
  objectName: "btnOk"
  text: "Ok"
}
======

Then use QObject.findChild to find "btnOk", and connect to its "clicked" signal
the same way you would do with a QPushButton.

> Currently, Qt Quick is a no-go for me. I had a close look and I don't
> like it...

QtQuick is extremely powerful. For an application with lots of graphics output,
I've jumped from QGraphicsScene to the new OpenGL based scene graph. The
performance and quality boost was unbelievable.
People complain a lot about QML, but only a few appear to realize the
potential the OpenGL scene graph has.

Best Regards,
Mathias




More information about the PyQt mailing list