[PyQt] Basic QQmlComponent question

Jim Baack jbaack at accelerantsys.com
Tue Apr 18 16:33:00 BST 2017

>----- Original Message -----
>From: "Phil Thompson" <phil at riverbankcomputing.com>
>To: "Jim Baack" <jbaack at accelerantsys.com>
>Cc: pyqt at riverbankcomputing.com
>Sent: Tuesday, April 18, 2017 12:53:09 AM
>Subject: Re: [PyQt] Basic QQmlComponent question

>On 18 Apr 2017, at 5:35 am, Jim Baack <jbaack at accelerantsys.com> wrote:
>> I am new to PyQt - enjoying it so far but have a lot to learn.
>> I was expecting the code below to print the type as "QGridLayout" but it is instead "QObject". Am I doing something wrong here or is my expectation incorrect? I appreciate the help.
>A QML GridLayout is completely unrelated (except they perform a similar function) to a widget based QGridLayout.
>QML UI's and widget UI's are completely separate UI implementations - they are not different interfaces to the same UI implementation.


Appreciate the quick response. I think the docs here http://doc.qt.io/qt-5/qtqml-cppintegration-interactqmlfromcpp.html led me astray because the section "Loading QML Objects from C++" describes casting the object created from the component to its actual C++ type. It sounds like that cannot be done in the case of GridLayout.

My goal was to load the layout and various Quick 2 widgets from QML as components, then add widgets as determined at runtime to the layout dynamically. I will think about another way to accomplish this. Thanks.


More information about the PyQt mailing list