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();

04-21 05:07