Results 1 to 16 of 16

Thread: VideoWidget problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: VideoWidget problem

    When do you query for the sizeHint()? Please show us the code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Jun 2010
    Posts
    137
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: VideoWidget problem

    Sure. Here it is

    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. ui->setupUi(this);
    6.  
    7.  
    8. this->mediaObject = new Phonon::MediaObject(this);
    9. this->audioOutput = new Phonon::AudioOutput(Phonon::VideoCategory,this);
    10. Phonon::createPath(mediaObject, audioOutput);
    11. Phonon::VideoWidget *videoWidget = new Phonon::VideoWidget(ui->frame);
    12. QHBoxLayout *hVideo = new QHBoxLayout(ui->frame);
    13. hVideo->addWidget(videoWidget);
    14. QSizePolicy policy;
    15. policy.setHorizontalPolicy(QSizePolicy::Fixed);
    16. policy.setVerticalPolicy(QSizePolicy::Fixed);
    17. videoWidget->setSizePolicy(policy);
    18. videoWidget->setAspectRatio(Phonon::VideoWidget::AspectRatioAuto);
    19. QSize size= videoWidget->sizeHint();
    20. videoWidget->setFixedSize(size);
    21. qDebug() << size;
    22. Phonon::createPath(mediaObject, videoWidget);
    23. QUrl url("output_1.avi");
    24. mediaObject->setCurrentSource(url);
    25.  
    26. mediaObject->setTickInterval(1000);
    27.  
    28. connect(mediaObject, SIGNAL(finished()), mediaObject, SLOT(deleteLater()));
    29. connect(ui->pause,SIGNAL(clicked()),mediaObject,SLOT(pause()));
    30. connect(ui->play,SIGNAL(clicked()),mediaObject,SLOT(play()));
    31. connect(ui->stop,SIGNAL(clicked()),mediaObject,SLOT(stop()));
    32. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: VideoWidget problem

    Let me repeat - query for the sizeHint() after the video starts playing. By the way, your code doesn't work because you set a fixed size on the video widget so how do you expect it to resize to proper size?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Jun 2010
    Posts
    137
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: VideoWidget problem

    Hi wysota you are right. It seems working fine now. I am getting desired output. Thank you very much for your help and sorry for my many questions .

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: VideoWidget problem

    No problem, we are here to help.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    baluk (24th October 2010)

Similar Threads

  1. Overlaying Widgets on top of VideoWidget
    By opsimath in forum Qt Programming
    Replies: 2
    Last Post: 9th June 2011, 13:29
  2. [MAC OSX] Mousetracking does not work in VideoWidget
    By Markus in forum Qt Programming
    Replies: 0
    Last Post: 1st October 2010, 23:23
  3. Zoom in a Phonon::VideoWidget
    By linus in forum Qt Programming
    Replies: 1
    Last Post: 26th March 2010, 21:13
  4. Replies: 1
    Last Post: 16th December 2009, 07:01
  5. Phonon::VideoWidget Problem with AspectRatio
    By tituslup in forum Qt Programming
    Replies: 1
    Last Post: 27th July 2008, 17:04

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.