Basic QQuickitem in a QQuickWindow
-
Hi guys,
@
QGuiApplication app( argc, argv );
QQuickWindow window; QQmlEngine engine; QQmlComponent component(&engine, QUrl::fromLocalFile(QLatin1String("qml/main.qml"))); QQuickItem *item = qobject_cast<QQuickItem*>(component.create()); item->setParentItem(window.contentItem()); qDebug() << item; window.show(); return app.exec()
@
The following code wont run correctly.
I get a blank window even though my qquickitem is an item that fills the parent and has a rectangle?An ideas?
-
AFAIK, you need the QQuickView.
Another thing: use
@
::setProperty("parent", window.contentItem());
@For some reason, ::setParent() tends not to work.