Can VLC-Qt widgets be used as Qt Widgets

  • I am using VLC-Qt library to play video files but the problem is that VlcWidgets cannot be used as QtWidgets . So, I cannot set the layout with buttons, video widget, slider etc in one parent widget. How can I fix this. Consider this example code :

    #include <QApplication>
    #include <VLCQtCore/Instance.h>
    #include <VLCQtCore/MediaPlayer.h>
    #include <VLCQtCore/MediaListPlayer.h>
    #include <VLCQtCore/MediaList.h>
    #include <VLCQtCore/Media.h>
    #include <VLCQtCore/VideoDelegate.h>
    #include <VLCQtWidgets/WidgetVideo.h>
    #include <QHBoxLayout>
    int main(int argc, char *argv[])
         QApplication a(argc, argv);
         QStringList lis{""};
         VlcInstance s(lis);
         VlcMediaListPlayer play(&s);
         VlcMediaList list(&s);
         return a.exec();

    When I run this code VlcWidgetVideo pops up but I want to but I want to add the widget into QLayout along with the control buttons. How can this be done ?

  • Moderators

    You can put VLC player in a layout and use it as any other widget. Check this example:

  • Lifetime Qt Champion


    Why can't it be used a QWidgets ?

    From a quick look at the documentation WidgetVideo is a QWidget so you can put it in a layout.

    You have to create the WidgetVideo yourself and set it on your media player.

    WARNING: not tested, it comes from the documentation of VlcQt and their example.

Log in to reply

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