PDA

View Full Version : Making a avi/mp4 movie the background of a QDialog?



qlands
28th August 2012, 16:06
Hi,

In another post I asked how to have a QMovie as a background of a QDialog. I managed that (thanks to the forum) but QMovie does not load mp4 or avi videos. I tried with Phonon::VideoPlayer however when I try to add the layout to the VideoPlayer the output is not correct (see image below). Here is the code:



player = new Phonon::VideoPlayer(Phonon::VideoCategory, this);

mainlayout = new QVBoxLayout();

mainlayout->setContentsMargins(0, 0, 0, 0);
mainlayout->addWidget(ui->label_3);

gridLayout = new QGridLayout();

verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
gridLayout->addWidget(ui->label, 2, 0, 1, 1);
gridLayout->addWidget(ui->label_2, 3, 0, 1, 1);
gridLayout->addWidget(ui->progressBar, 2, 1, 1, 1);
gridLayout->addWidget(ui->progressBar_2, 3, 1, 1, 1);
gridLayout->addWidget(ui->lblproc, 1, 0, 1, 2);
gridLayout->addItem(verticalSpacer, 0, 0, 1, 1);

mainlayout->addLayout(gridLayout);

delete player->layout();
player->setLayout(mainlayout);

bkgLayout = new QVBoxLayout(this);
bkgLayout->addWidget(player);

Phonon::MediaSource source("./mellow-meadow.mp4");
player->load(source);
player->play();


Here is the image showing the result. The video appears very small as a black box with the yellow bar. It should cover the whole dialog and the set of widgets on top of the video.
8154

Any idea how to make it work? Or which widget to use?

Many thanks,
Carlos.