[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] QtQuick ApplicationWindow
From:       Fabien Castan <fabcastan () gmail ! com>
Date:       2013-11-17 12:37:32
Message-ID: CAJQWia6eZB9Qn+H+K-He=oZB2r9-5oUPRefzLgikROoFRYg=2g () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I use it on desktop. It's in QtQuick.Controls.
http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-applicationwindow.html



2013/11/17 Jens Persson <xerxes2@gmail.com>

> AFAIK there is no such thing as an ApplicationWindow in QtQuick. Where did
> you find that? It exists in Silica though.
>
> Greets Jens
>
>
> On Sun, Nov 17, 2013 at 1:12 PM, Fabien Castan <fabcastan@gmail.com>wrote:
>
>> 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@riverbankcomputing.com>
>>
>>> On Sat, 16 Nov 2013 20:22:50 +0100, Fabien Castan <fabcastan@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
>>>
>>
>>
>> _______________________________________________
>> PyQt mailing list    PyQt@riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>
>

[Attachment #5 (text/html)]

<div dir="ltr">I use it on desktop. It&#39;s in QtQuick.Controls.<div><a \
href="http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-applicati \
onwindow.html">http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-applicationwindow.html</a><br>
 </div><div><br></div></div><div class="gmail_extra"><br><br><div \
class="gmail_quote">2013/11/17 Jens Persson <span dir="ltr">&lt;<a \
href="mailto:xerxes2@gmail.com" \
target="_blank">xerxes2@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div \
dir="ltr"><div>AFAIK there is no such thing as an ApplicationWindow in QtQuick. Where \
did you find that? It exists in Silica though.<br><br></div>Greets Jens<br></div><div \
class="gmail_extra"><br><br><div class="gmail_quote"> <div><div class="h5">
On Sun, Nov 17, 2013 at 1:12 PM, Fabien Castan <span dir="ltr">&lt;<a \
href="mailto:fabcastan@gmail.com" target="_blank">fabcastan@gmail.com</a>&gt;</span> \
wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"> <div><div class="h5">
<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/" \
target="_blank">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>&gt; python3 testQmlApplicationWindow.py \
</div><div>A</div><div>B</div><div>C</div><div>D</div><div>E</div><div>F</div>&lt;Here \
the application is created, I can use it&gt;<br>&lt;Now I close the \
application&gt;<div>


Z</div><div>&lt;But it stays stuck here... I have to kill \
it.&gt;<br></div><div><br></div><div>The &#39;print(&quot;End&quot;)&#39; is never \
called.</div><div>If I create the QGuiApplication outside of the function, it works \
fine. Something like:</div>


<div>&quot;</div><div><pre style="font-family:Consolas,&#39;Liberation \
Mono&#39;,Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51);line-height:18px"><div \
style="padding-left:10px"> <span style="font-weight:bold">if</span> \
<span>__name__</span> <span style="font-weight:bold">==</span> <span \
style="color:rgb(221,17,68)">&#39;__main__&#39;</span><span>:</span></div> <div \
style="padding-left:10px">    app = TestApp(<span>sys</span><span \
style="font-weight:bold">.</span><span>argv</span>)</div><div \
style="padding-left:10px">  <span>main</span><span>(</span><span>sys</span><span \
style="font-weight:bold">.</span><span>argv, app</span><span>)</span></div><div \
style="padding-left:10px"> <span>    app.exec_()</span></div><div \
style="padding-left:10px"><span>&quot;</span></div></pre></div><div><br></div><div>2) \
The second problem is that I can&#39;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/" \
target="_blank">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>&gt; python3 \
testQmlApplicationWindow.py \
</div><div>A</div><div>B</div><div>C</div></div><div><div>&lt;It stays stuck here... \
I have to kill it.&gt;<br></div></div>

<div>
<br></div><div>So it stays stuck on the \
&quot;component.loadUrl()&quot;</div><div><br></div><div><br></div><div>Regards,</div><div>Fabien</div><div><br></div></div><div><div><div \
class="gmail_extra"> <br><br><div class="gmail_quote">
2013/11/16 Phil Thompson <span dir="ltr">&lt;<a \
href="mailto:phil@riverbankcomputing.com" \
target="_blank">phil@riverbankcomputing.com</a>&gt;</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 &lt;<a \
href="mailto:fabcastan@gmail.com" target="_blank">fabcastan@gmail.com</a>&gt;<br> \
wrote:<br> <div><div>&gt; Hi,<br>
&gt;<br>
&gt; I&#39;m trying to create a qtquick application using PyQt5.<br>
&gt; I would like to use an ApplicationWindow as the top level item of my qml<br>
&gt; file. To do that, I shouldn&#39;t use the QQuickView but directly<br>
QQmlComponent<br>
&gt; as it&#39;s done here with a non-graphic example:<br>
&gt; <a href="http://pyqt.sourceforge.net/Docs/PyQt5/qml.html" \
target="_blank">http://pyqt.sourceforge.net/Docs/PyQt5/qml.html</a><br> &gt;<br>
&gt; My sample code:<br>
&gt; <a href="https://github.com/buttleofx/testsQml/tree/qmlApplicationWindow" \
target="_blank">https://github.com/buttleofx/testsQml/tree/qmlApplicationWindow</a><br>
 &gt;<br>
&gt; But it crashes:<br>
&gt; A<br>
&gt; B<br>
&gt; C<br>
&gt; D<br>
&gt; QObject::connect: Cannot connect (null)::destroyed(QObject*) to<br>
&gt; QWindow::screenDestroyed(QObject*)<br>
&gt; Erreur de segmentation (core dumped)<br>
&gt;<br>
&gt; Same result if I use Window instead of ApplicationWindow.<br>
&gt;<br>
&gt; Any idea?<br>
&gt;<br>
&gt; Regards,<br>
&gt; Fabien<br>
<br>
</div></div>It&#39;s not a non-graphic application. Use a QGuiApplication instead of \
a<br> QCoreApplication.<br>
<span><font color="#888888"><br>
Phil<br>
</font></span></blockquote></div><br></div>
</div></div><br></div></div>_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" \
target="_blank">PyQt@riverbankcomputing.com</a><br> <a \
href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br></div>
 </blockquote></div><br></div>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic