Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can VLC-Qt widgets be used as Qt Widgets
QtWS25 Last Chance

Can VLC-Qt widgets be used as Qt Widgets

Scheduled Pinned Locked Moved Unsolved General and Desktop
qlayoutqwidgetvlc-qt
3 Posts 3 Posters 3.5k Views
  • 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.
  • A Offline
    A Offline
    AyushExel204
    wrote on 18 May 2016, 09:43 last edited by AyushExel204
    #1

    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
    0
    • J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 18 May 2016, 10:49 last edited by
      #2

      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
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 18 May 2016, 10:54 last edited by
        #3

        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
        0

        3/3

        18 May 2016, 10:54

        • Login

        • Login or register to search.
        3 out of 3
        • First post
          3/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved