PDA

View Full Version : To play mplayer in widget



Deepak Mishra
3rd November 2007, 07:25
Hi to all,
Please help me, i want a movie to be played in a seprate widget when the user click on an item in a qlistviewitem. When i am using the following code
QString file="media/" + check;
QWidget *wd=new QWidget;
wd->setMinimumSize(QSize(646, 512));
QString program = "mplayer";
QStringList arguments;
arguments << "-wid" << QString::number(wd->winId()) <<file ;
myProcess= new QProcess;
myProcess->start(program, arguments);
wd->show();
the movie starts playing in the widget before the widget containing the qlistview
when i am using the code
QString file="media/" + check;
QWidget *wd=new QWidget(this};
wd->setMinimumSize(QSize(646, 512));
QString program = "mplayer";
QStringList arguments;
arguments << "-wid" << QString::number(wd->winId()) <<file ;

myProcess= new QProcess;
myProcess->start(program, arguments);
wd->show();

movie starts playing in the "this" means parent widget.

But i want movie to be played in a seprate window at front .

Please help me .
Thanking you all

wysota
4th November 2007, 17:42
If you want a widget that is a standalone window, don't pass a pointer to the parent in the constructor. There is another way to obtain the same effect, but you shouldn't need it.