Update ImageView in QML

大兔子大兔子 提交于 2019-12-13 09:55:20

问题


I am processing an image using opencv during runtime and want to display the updated version of this image in QML using imageView, i currently am creating a new image file at runtime and reassigning its path to the imageView in QML, is there any better method for this?


回答1:


If I understand the question correctly, I do this by connecting a changed signal emitted from the c++ code and connect it to a receiver that forces a reload on the qml side :

// MyImage.qml
Image {
    cache: false
    function reload() {
        var tmpSource = source;
        source = "";
        source = tmpSource;
    }
}


来源:https://stackoverflow.com/questions/29590119/update-imageview-in-qml

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