<div dir="ltr">Oops... Thanks!<div><br></div><div>Now, I have 2 strange things:</div><div><br></div><div>1) If I put all the code into a function, the application stay stuck when I try to close it.</div><div><br></div><div>
<span style="color:rgb(17,85,204);font-family:arial,sans-serif;font-size:13px;text-decoration:underline"><a href="https://github.com/buttleofx/">https://github.com/buttleofx/</a></span><span style="color:rgb(17,85,204);font-family:arial,sans-serif;font-size:13px;text-decoration:underline">testsQml/tree/</span><span style="color:rgb(17,85,204);font-family:arial,sans-serif;font-size:13px;text-decoration:underline">qmlApplicationWindow</span><br>
</div><div>> python3 testQmlApplicationWindow.py </div><div>A</div><div>B</div><div>C</div><div>D</div><div>E</div><div>F</div><Here the application is created, I can use it><br class=""><Now I close the application><div>
Z</div><div><But it stays stuck here... I have to kill it.><br></div><div><br></div><div>The 'print("End")' is never called.</div><div>If I create the QGuiApplication outside of the function, it works fine. Something like:</div>
<div>"</div><div><pre style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51);line-height:18px"><div class="" id="LC57" style="padding-left:10px">
<span class="" style="font-weight:bold">if</span> <span class="">__name__</span> <span class="" style="font-weight:bold">==</span> <span class="" style="color:rgb(221,17,68)">'__main__'</span><span class="">:</span></div>
<div class="" id="LC58" style="padding-left:10px">    app = TestApp(<span class="">sys</span><span class="" style="font-weight:bold">.</span><span class="">argv</span>)</div><div class="" id="LC59" style="padding-left:10px">
    <span class="">main</span><span class="">(</span><span class="">sys</span><span class="" style="font-weight:bold">.</span><span class="">argv, app</span><span class="">)</span></div><div class="" id="LC59" style="padding-left:10px">
<span class="">    app.exec_()</span></div><div class="" id="LC59" style="padding-left:10px"><span class="">"</span></div></pre></div><div><br></div><div>2) The second problem is that I can't override the notify function of the QGuiApplication.</div>
<div>In my sample code there: <span style="font-size:13px;color:rgb(17,85,204);font-family:arial,sans-serif;text-decoration:underline"><a href="https://github.com/buttleofx/">https://github.com/buttleofx/</a></span><span style="font-size:13px;color:rgb(17,85,204);font-family:arial,sans-serif;text-decoration:underline">testsQml/tree/</span><span style="font-size:13px;color:rgb(17,85,204);font-family:arial,sans-serif;text-decoration:underline">qmlApplicationWindow</span>, the code is commented...</div>
<div>If I uncomment the notify function:</div><div><div>> python3 testQmlApplicationWindow.py </div><div>A</div><div>B</div><div>C</div></div><div><div><It stays stuck here... I have to kill it.><br></div></div><div>
<br></div><div>So it stays stuck on the "component.loadUrl()"</div><div><br></div><div><br></div><div>Regards,</div><div>Fabien</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
2013/11/16 Phil Thompson <span dir="ltr"><<a href="mailto:phil@riverbankcomputing.com" target="_blank">phil@riverbankcomputing.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sat, 16 Nov 2013 20:22:50 +0100, Fabien Castan <<a href="mailto:fabcastan@gmail.com">fabcastan@gmail.com</a>><br>
wrote:<br>
<div><div class="h5">> Hi,<br>
><br>
> I'm trying to create a qtquick application using PyQt5.<br>
> I would like to use an ApplicationWindow as the top level item of my qml<br>
> file. To do that, I shouldn't use the QQuickView but directly<br>
QQmlComponent<br>
> as it's done here with a non-graphic example:<br>
> <a href="http://pyqt.sourceforge.net/Docs/PyQt5/qml.html" target="_blank">http://pyqt.sourceforge.net/Docs/PyQt5/qml.html</a><br>
><br>
> My sample code:<br>
> <a href="https://github.com/buttleofx/testsQml/tree/qmlApplicationWindow" target="_blank">https://github.com/buttleofx/testsQml/tree/qmlApplicationWindow</a><br>
><br>
> But it crashes:<br>
> A<br>
> B<br>
> C<br>
> D<br>
> QObject::connect: Cannot connect (null)::destroyed(QObject*) to<br>
> QWindow::screenDestroyed(QObject*)<br>
> Erreur de segmentation (core dumped)<br>
><br>
> Same result if I use Window instead of ApplicationWindow.<br>
><br>
> Any idea?<br>
><br>
> Regards,<br>
> Fabien<br>
<br>
</div></div>It's not a non-graphic application. Use a QGuiApplication instead of a<br>
QCoreApplication.<br>
<span class="HOEnZb"><font color="#888888"><br>
Phil<br>
</font></span></blockquote></div><br></div>