Update ImageView in QML

2019-09-21 19:10发布

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条回答
一夜七次
2楼-- · 2019-09-21 19:43

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;
    }
}
查看更多
登录 后发表回答