Showing video in qml



  • Hi,

    I am beginner in qml and qt, so my question is maybe little primitive, but after some hours of googling I didn't find appropriate answer.

    I want to show live camera output in qml app. I have C++ snippet that works in QtWidget app (I used code from camera manufacturer and this tutorial to do that:
    OpenGL Widget to show OpenCV images in a Qt GUI
    ), but don't know how to do that in QtQuick app. Can you give me some advice about that or some example easy to understand?

    I started to study this example: http://doc.qt.io/qt-5/gettingstartedqml.html#extending-qml-using-qt-c , but didn't sure will be that useful for me. Can I use Q_PROPERTY to send frames to qml?



  • Hi! You need to implement your own visual item for use with QtQuick. There are two options for this: Either create your own class inheriting from QQuickPaintedItem or create a class inheriting from QQuickItem. The second approach is a bit more complicated but has the best performance. The first appoach is slower but also simpler because you can use QPainter to render your item. See Writing QML Extensions with C++ to get an idea of how to use said first option.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.