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. Auto play video files in tablewidget
Qt 6.11 is out! See what's new in the release blog

Auto play video files in tablewidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 369 Views 1 Watching
  • 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.
  • MegamouseM Offline
    MegamouseM Offline
    Megamouse
    wrote on last edited by
    #1

    Hi.
    Is it possible to display videos in a tablewidget just like you would display an image?

    I thought I'd ask here first before I even try.

    Best regards,
    Megamouse

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      If you mean as using the decoration role, then no, you'll have to implement that yourself.

      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
      • A Offline
        A Offline
        anil_arise
        wrote on last edited by anil_arise
        #3

        Example: add five row with videowidget

        ui->tableWidget->setColumnCount(2);
        for(int i=0;i<5;i++)
        {
        QLabel *label = new QLabel(this);
        label->setText("VIDEO"+QString::number(i+1));
        QVideoWidget *videoWidget = new QVideoWidget(this);
        QMediaPlayer *mediaPlayer = new QMediaPlayer;
        mediaPlayer->setVideoOutput(videoWidget);
        QMediaPlaylist *Mplaylist = new QMediaPlaylist;
        Mplaylist->setPlaybackMode(QMediaPlaylist::Loop);
        Mplaylist->addMedia(QUrl::fromLocalFile("/root/Videos/Akon.mp4")); // add playlist
        mediaPlayer->setPlaylist(Mplaylist);
        ui->tableWidget->insertRow(ui->tableWidget->rowCount());
        ui->tableWidget->setCellWidget(ui->tableWidget->rowCount()-1,0,label);
        ui->tableWidget->setCellWidget(ui->tableWidget->rowCount()-1,1,videoWidget);
        mediaPlayer->play();
        }

        you can handle it's own way .

        1 Reply Last reply
        1

        • Login

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