本文共 1189 字,大约阅读时间需要 3 分钟。
#include#include int main(int argc, char *argv[]){ QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec();}
#include#include int main(int argc, char *argv[]){ QGuiApplication app(argc, argv); QQuickView *view = new QQuickView; view->setResizeMode(QQuickView::SizeRootObjectToView); view->setSource(QUrl(QStringLiteral("qrc:/main.qml"))); view->show(); return app.exec();}
QQuickWidget *view = new QQuickWidget; view->setSource(QUrl::fromLocalFile("myqmlfile.qml")); view->show();
转载地址:http://xyjko.baihongyu.com/