How to add qml to mainwindow ui file
Unsolved
General and Desktop
-
Can somebody help me how to add qml to mainwindow ui. I added a QQuickwidget in mainwindow.ui from designer.
Then I added following code:
QQuickView *qmlView = new QQuickView(); qmlView->setSource(QUrl::fromLocalFile("test.qml")); ui->widget->createWindowContainer(qmlView, this);
But I can see nothing when I run the program inside QQuickWidget.
-
@milan said in How to add qml to mainwindow ui file:
Can somebody help me how to add qml to mainwindow ui. I added a QQuickwidget in mainwindow.ui from designer.
Then I added following code:
QQuickView *qmlView = new QQuickView(); qmlView->setSource(QUrl::fromLocalFile("test.qml")); ui->widget->createWindowContainer(qmlView, this);
If you added a QQuickWidget via designer, why adding anoher QQuickView via code!?
just access your QuickWidget and set the source:
ui->quickWidget->setSource(QUrl(QStringLiteral("qrc:/test.qml")));