QMediaPlayer Widget causes invisible window



  • I want to add a videoplayer inside of a qtabwidget in my .ui form file. When the program is ran (Windows 8) the program window is invisible and the video plays (you can hear it). Also, if I comment out everything after "ui->Information->addTab(videoWidget, "video");" the program's UI loads like normal and the new tab is created "video", however nothing works cause the mediaPlayer code is commented out. This is the code for the media widget:
    mainwin.h
    @private:
    QMediaPlayer mediaPlayer;@

    mainwin.cpp
    @ ui->setupUi(this);
    QVideoWidget *videoWidget = new QVideoWidget();
    ui->Information->addTab(videoWidget, "video");
    mediaPlayer.setVideoOutput(videoWidget);
    mediaPlayer.setMedia(QUrl("link"));
    mediaPlayer.play();@

    Can someone help? Thanks!


Log in to reply
 

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