1、QQmlApplicationEngine engine;engine.load(QUrl(QStringLiteral("qrc:/main.qml")));if (engine.rootObjects().isEmpty()) return -1;2、QQuickView *view = new QQuickView;view->setSource(QUrl("qrc:/main.qml"));view->show();