[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'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"><<a \
href="mailto:xerxes2@gmail.com" \
target="_blank">xerxes2@gmail.com</a>></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"><<a \
href="mailto:fabcastan@gmail.com" target="_blank">fabcastan@gmail.com</a>></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>> 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><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 \
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)">'__main__'</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>"</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/" \
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>> 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><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" target="_blank">fabcastan@gmail.com</a>><br> \
wrote:<br> <div><div>> 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><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