Reference
qmlscene是什么
- Qt 5 includes qmlscene, a utility that loads and displays QML documents even before the application is complete.
- The qmlscene utility is meant to be used for testing your QML applications, and not as a launcher in a production environment. To launch a QML application in a production environment, develop a custom C++ application or bundle the QML file in a module.
使用qmlscene加载qml文件
-
To load a .qml file, run the tool and select the file to be opened, or provide the file path on the command prompt:
qmlscene myqmlfile.qml
-
假如我们有一个文件
LXWQmlSceneTest.qml
,内容如下:
import QtQuick 2.3
Rectangle {
id: simpleButton
color: "grey"
width: 150; height: 75
Text {
id: buttonLabel
anchors.centerIn: parent
text: "button label"
}
}
我们就可以直接这样查看结果:
# 我电脑上qmlscene的安装路径
cd /Users/gss/Qt5.6.0/5.6/clang_64/bin
./qmlscene /Users/gss/Documents/qttest/lxw_qml_tutorial/LXWQmlSceneTest.qml
网友评论