美文网首页
2 qmlscene是什么,有什么用

2 qmlscene是什么,有什么用

作者: 码农二哥 | 来源:发表于2017-06-04 19:56 被阅读234次

    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 
    

    相关文章

      网友评论

          本文标题:2 qmlscene是什么,有什么用

          本文链接:https://www.haomeiwen.com/subject/xghbfxtx.html