Playing a Video file(.wmv) in the entire dialog window



  • I want to play the video file in my dialog window. I used the following codes in my program and its playing on left corner of my dialog window with the size of 32*32 , but i want to play the video on my entire Dialog window.

    @ //TestDlg.h
    #include <QDialog>

    namespace Ui {
    class TestDlg;
    }

    class TestDlg : public QDialog
    {
    Q_OBJECT

    public:
    explicit TestDlg(QWidget *parent = 0);
    ~TestDlg();

    Phonon::MediaObject *obj_MediaObject;
    Phonon::VideoWidget *wid_videoWidget;
    Phonon::AudioOutput *aio_audioOutput;
    

    private:
    Ui::TestDlg *ui;
    };
    @
    @
    //TestDlg.cpp
    TestDlg::TestDlg(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::TestDlg)
    {
    ui->setupUi(this);

    // setup the objects:
    obj_MediaObject = new Phonon::MediaObject(this);
    wid_videoWidget = new Phonon::VideoWidget(this);
     aio_audioOutput = new Phonon::AudioOutput(Phonon::VideoCategory,this);
    //clear the mediaobject:
    obj_MediaObject->clearQueue();
    //Put a video in the queue:
    obj_MediaObject->enqueue(Phonon::MediaSource("C:\\Wildlife.wmv"));
    //make the proper connections:
    Phonon::createPath(obj_MediaObject, wid_videoWidget);
    // to link the mediaobject with the video widget.
    Phonon::createPath(obj_MediaObject, aio_audioOutput);
    // to link the mediaobject with audio output.  
    

    //play the video:
    obj_MediaObject->play();

    }
    @


  • Moderators

    You didn't use a layout in your dialog. By default a widget will be placed at the top right then.


Log in to reply
 

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