[PyQt] QtQuick ApplicationWindow
Fabien Castan
fabcastan at gmail.com
Sun Nov 17 12:12:15 GMT 2013
Oops... Thanks!
Now, I have 2 strange things:
1) If I put all the code into a function, the application stay stuck when I
try to close it.
https://github.com/buttleofx/testsQml/tree/qmlApplicationWindow
> python3 testQmlApplicationWindow.py
A
B
C
D
E
F
<Here the application is created, I can use it>
<Now I close the application>
Z
<But it stays stuck here... I have to kill it.>
The 'print("End")' is never called.
If I create the QGuiApplication outside of the function, it works fine.
Something like:
"
if __name__ == '__main__':
app = TestApp(sys.argv)
main(sys.argv, app)
app.exec_()
"
2) The second problem is that I can't override the notify function of the
QGuiApplication.
In my sample code there: https://github.com/buttleofx/testsQml/tree/
qmlApplicationWindow, the code is commented...
If I uncomment the notify function:
> python3 testQmlApplicationWindow.py
A
B
C
<It stays stuck here... I have to kill it.>
So it stays stuck on the "component.loadUrl()"
Regards,
Fabien
2013/11/16 Phil Thompson <phil at riverbankcomputing.com>
> On Sat, 16 Nov 2013 20:22:50 +0100, Fabien Castan <fabcastan at gmail.com>
> wrote:
> > Hi,
> >
> > I'm trying to create a qtquick application using PyQt5.
> > I would like to use an ApplicationWindow as the top level item of my qml
> > file. To do that, I shouldn't use the QQuickView but directly
> QQmlComponent
> > as it's done here with a non-graphic example:
> > http://pyqt.sourceforge.net/Docs/PyQt5/qml.html
> >
> > My sample code:
> > https://github.com/buttleofx/testsQml/tree/qmlApplicationWindow
> >
> > But it crashes:
> > A
> > B
> > C
> > D
> > QObject::connect: Cannot connect (null)::destroyed(QObject*) to
> > QWindow::screenDestroyed(QObject*)
> > Erreur de segmentation (core dumped)
> >
> > Same result if I use Window instead of ApplicationWindow.
> >
> > Any idea?
> >
> > Regards,
> > Fabien
>
> It's not a non-graphic application. Use a QGuiApplication instead of a
> QCoreApplication.
>
> Phil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20131117/b3236ae6/attachment.html>
More information about the PyQt
mailing list