PDA

View Full Version : How to display QVideowidget on a secondary mainwindow



Allaye
20th May 2019, 10:20
QVideoWidget *vw = new QVideoWidget() ;

QMediaPlayer * mp = new QMediaPlayer(vw);

QString vidstring = QFileDialog::getOpenFileName(this, "Select video file", QDir::homePath());

mp->setMedia(QUrl::fromLocalFile(vidstring));
mp->setVideoOutput(vw);
vw->setGeometry(100, 100, 500, 500);
vw->show();
mp->play();


}
[ATTACH=CONFIG]13138 i want to make the video display inside the window on the right side
Am having two classes one contain the main window while the other also has it own window,
whenever I play the video the Qvideowiget has it own window, I want to display the QVideowidget
inside the second windows, but all my effect has not been fruitful... thanks in advance ```

anda_skoa
20th May 2019, 13:09
Create the video widget as a child of the widget it should be contained in and add it to that container's layout.

Just like with any other widget.

Cheers,
_