Results 1 to 15 of 15

Thread: setting moviewidget on a QFrame?

  1. #1
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question setting moviewidget on a QFrame?

    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.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: setting moviewidget on a QFrame?

    But what's the problem? QFrame is a QWidget. Any QWidget can be placed to a layout.
    J-P Nurmi

  3. #3
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: setting moviewidget on a QFrame?

    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.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: setting moviewidget on a QFrame?

    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.
    J-P Nurmi

  5. #5
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: setting moviewidget on a QFrame?

    I have set the color by following

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

    but my application does not show the movie wiindow.

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: setting moviewidget on a QFrame?

    Show the relevant code.
    J-P Nurmi

  7. #7
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: setting moviewidget on a QFrame?

    I have a frame named QFrame on the mainwindow in which I want to show the movie widget.


    Qt Code:
    1. QVBoxLayout *movieWidgetLayout = new QVBoxLayout;
    2.  
    3. movieWindow = new MovieWidget(this); ////Movie widget object
    4. movieWindow->setStyle(new QMotifStyle);
    5. movieWindow->setStyleSheet("color: red; background-color: white;");
    6. movieWidgetLayout->addWidget(movieWindow);
    7.  
    8. MainFrame->setLayout(movieWidgetLayout);
    To copy to clipboard, switch view to plain text mode 
    Last edited by vishal.chauhan; 24th March 2008 at 10:19.

  8. #8
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: setting moviewidget on a QFrame?

    Is MovieWidget direct subclass of QWidget? Is MainFrame a top-level window or is it in a layout?
    J-P Nurmi

  9. #9
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: setting moviewidget on a QFrame?

    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 ).

  10. #10
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: setting moviewidget on a QFrame?

    As far as I remember setting a background color with style sheets doesn't work with plain QWidget.
    J-P Nurmi

  11. #11
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: setting moviewidget on a QFrame?

    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.

  12. #12
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: setting moviewidget on a QFrame?

    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.

  13. #13
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: setting moviewidget on a QFrame?

    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.

  14. #14
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: setting moviewidget on a QFrame?

    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.

  15. #15
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: setting moviewidget on a QFrame?

    Quote Originally Posted by vishal.chauhan View Post
    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.

    Quote Originally Posted by vishal.chauhan View Post
    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...
    J-P Nurmi

Similar Threads

  1. Setting QFrame palette in Designer doesn't "stick"
    By Doug Broadwell in forum Qt Tools
    Replies: 1
    Last Post: 9th September 2007, 21:44
  2. Setting background image of QFrame
    By Claymore in forum Qt Programming
    Replies: 2
    Last Post: 12th February 2007, 19:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.