[PyQt] Basic QQmlComponent question

Jim Baack jbaack at accelerantsys.com
Tue Apr 18 05:35:28 BST 2017


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.

Jim



engine = QQmlEngine()
gridlayouts = QQmlComponent(engine)
gridlayouts.loadUrl(QUrl.fromLocalFile('GL.qml'))
gridlayout1 = gridlayouts.create()
print(type(gridlayout1))





 -- GL.qml

import QtQuick 2.0
import QtQuick.Layouts 1.3


GridLayout {
    id: gridLayout
    x: 88
    y: 77
    width: 487
    height: 337
}


More information about the PyQt mailing list