PDA

View Full Version : setting moviewidget on a QFrame?



vishal.chauhan
20th March 2008, 04:30
Hi All,

I am using the following API to play the audio and video file.
http://doc.trolltech.com/qq/qq20-hiviews.html

It is playing audio and video fine but I have a problem that the moviewidget always show on the QWidget but I want to show it on a QFrame inside a QMainWindow.

If any one knows how I can do this then please help me.

Thanks.

jpn
20th March 2008, 09:05
But what's the problem? QFrame is a QWidget. Any QWidget can be placed to a layout.

vishal.chauhan
20th March 2008, 09:20
Actually I am taking a QVBoxLayout but in application it is taking
Layout()->addWidget(movieWindow);

and I have set the layout of the frame to QVBoxLayout and then add the moviwWidget in the QVBoxLayout.

it is not giving any error but it is not showing any widget in QFrame.

jpn
20th March 2008, 11:54
I suspect it to be a simple layout problem. Anyway, can you verify that the widget is laid out correctly? Make it red with style sheets and see where it appears if it does appear anywhere.

vishal.chauhan
24th March 2008, 06:10
I have set the color by following

movieWindow->setStyleSheet("color: red; background-color: white;");

but my application does not show the movie wiindow.

jpn
24th March 2008, 09:56
Show the relevant code.

vishal.chauhan
24th March 2008, 09:59
I have a frame named QFrame on the mainwindow in which I want to show the movie widget.





QVBoxLayout *movieWidgetLayout = new QVBoxLayout;

movieWindow = new MovieWidget(this); ////Movie widget object
movieWindow->setStyle(new QMotifStyle);
movieWindow->setStyleSheet("color: red; background-color: white;");
movieWidgetLayout->addWidget(movieWindow);

MainFrame->setLayout(movieWidgetLayout);

jpn
24th March 2008, 10:38
Is MovieWidget direct subclass of QWidget? Is MainFrame a top-level window or is it in a layout?

vishal.chauhan
24th March 2008, 10:50
Yes movieWidget is a direct subclass of QWidget and MainFrame is a Top level window in mainwindow(mainwindow also have some other top level window ).

jpn
24th March 2008, 11:15
As far as I remember setting a background color with style sheets doesn't work with plain QWidget.

vishal.chauhan
24th March 2008, 11:25
But Even If I subclass the movieWidget from QFrame or some other class then it still not showing the color. If I add another widget in the MainFrame then only that widget is visible although movieWidget is look like taking space in the frame but nothing is visible.

vishal.chauhan
25th March 2008, 06:39
Still no success.
Is it possible or not to add movie widget in any widget other than the QWidget.
I think movieWidget should add to any parent widget and if it not then it is a big bug in the above API.

vishal.chauhan
25th March 2008, 07:10
Now I am able to set it in a Frame.
Actually It does not add to be in a Layout we have to just make the parent of movieWidget to label.

Thanks for all the reply.

vishal.chauhan
25th March 2008, 11:37
Hi All,

I want to do one more thing in the above API that currently the movie or song play when the user click on the play button.

I want to know is it possible to play the music by default when the user select the movie or song.

jpn
25th March 2008, 11:58
Now I am able to set it in a Frame.
Actually It does not add to be in a Layout we have to just make the parent of movieWidget to label.
Still sounds like a layout issue. Installing two layouts by accident on the same widget makes the latter one not to be installed.



I want to do one more thing in the above API that currently the movie or song play when the user click on the play button.

I want to know is it possible to play the music by default when the user select the movie or song.
I'm afraid QuickTime programming doesn't have much to do with Qt programming so this would be a wrong forum for such question...