1. 通过qt create生成qrc资源文件。
2. 在main.cpp中通过
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
//viewer.setMainQmlFile(QUrl("qrc:/qml/NeedCam/Index.qml"));
viewer.setSource(QUrl("qrc:/qml/Index.qml"))指定程序在qrc中寻找qml文件。
3. 在main.cpp中通过在资源路径前加 : 指定在qrc中寻找图片,国际化等其他文件
translator.load(":qml/i18_zh.qm");