Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Can VLC-Qt widgets be used as Qt Widgets

    General and Desktop
    qlayout qwidget vlc-qt
    3
    3
    3051
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • AyushExel204
      AyushExel204 last edited by AyushExel204

      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);
           list.addMedia(&VlcMedia("martian.mkv",true,&s));
           play.setMediaList(&list);
           play.next();
           play.mediaPlayer()->play();
           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 ?

      1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion last edited by

        You can put VLC player in a layout and use it as any other widget. Check this example: https://github.com/vlc-qt/examples/tree/master/simple-player

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi,

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply Reply Quote 0
          • First post
            Last post