Rebuilding again and again to view the imported QML file changes

我们两清 提交于 2019-12-23 03:30:25

问题


I have imported a qml file say A in other qml say B. Whenever I make some changes in A , it doesn't reflect in the Application. I have to again clean and rebuild to view the changes i made, which is very time-consuming. Is there an easier and efficient way of doing this, so time could be saved .

Or another way of saying this is :
qrc files are not added to Makefile dependencies in debug_and_release mode

example

A.qml

 Rectangle {
        id:xyz
     Button
    {
    id: ButtonA
    }
 }

B.qml

Rectangle{
          A {
                id:abc
            }
         } 

I am using qt 4, qtquick 1.0.


回答1:


You can make two independent qrc files, one for debug which is only includes resources like sounds, images, fonts and ... and another qrc for release which includes qml files too. Then you can use point to the qml files relatively with your current working directory (could be set in Build & Run pane) without need to include them in qrc which requires time consuming compilation and linkage. Also be aware, the root qml file should be pointed by relative (or absolute path) from C++ side, and no other changes are required to other qml files and they works perfectly on both release and debug mode

In your pro file :

debug {
    RESOURCES     = application_debug.qrc
}

!debug {
    RESOURCES     = application_release.qrc
}



回答2:


You can install the new qt creator, it will solve the problem. Worked for me. I installed QT creator 4.8.7.



来源:https://stackoverflow.com/questions/44029621/rebuilding-again-and-again-to-view-the-imported-qml-file-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!