qt - QImage into QML -
my application receives live-stream of jpegs on network (16 frames per second). live-stream should displayed using qml. receiving part written in c++, ui written using qml.
how image data qml window? have looked around how qimage displayed, did not find solution yet.
implementing qdeclarativeimageprovider , refreshing source of image on , on again using different name seems solution, see http://qt-project.org/doc/qt-4.8/qdeclarativeimageprovider.html.
yes, unfortunately image
element missing update()
method (to forcibly reset it). setting same source url not trigger update.
you can use workaround:
image { source: "image://yourimageprovider/something" cache: false function reload() { var oldsource = source; source = ""; source = oldsource; } }
(or switch between 2 urls, same provider name, different paths...)
you should push jpegs receive qml layer. once receive new image, should emit signal c++'s side object exposed qml engine, , connect signal reload()
function. connections
element there.
connections { target: myc++objectexposedtotheqmlengine onnewframereceived: image.reload(); }
Comments
Post a Comment