Results 1 to 16 of 16

Thread: VideoWidget problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2010
    Posts
    137
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: VideoWidget problem

    Thanks for the reply. I am getting some syntax errors when setting QSizePolicy. Here I am copying my code can please check whats wrong.

    Qt Code:
    1. QSizePolicy policy = new QSizePolicy();
    2. policy.setHorizontalPolicy(QSizePolicy::Fixed);
    3. policy.setVerticalPolicy(QSizePolicy::Fixed);
    4. videoWidget->setSizePolicy(policy);
    To copy to clipboard, switch view to plain text mode 

    Thank You,
    baluk

  2. #2
    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

    Obviously the first line is wrong, it should be:
    Qt Code:
    1. QSizePolicy policy;
    To copy to clipboard, switch view to plain text mode 
    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.


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

    Default Re: VideoWidget problem

    I still can't rid of the main problem. I have 3 QFrames and I applied grid layout to all. And I used one frame for video play. QSizePolicy doesn't solve the problem.

  4. #4
    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

    Please show us some code reproducing the problem. Just please don't post your whole application.
    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.


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

    Default Re: VideoWidget problem

    Sure.
    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.  
    13. QSizePolicy policy;
    14. policy.setHorizontalPolicy(QSizePolicy::Fixed);
    15. policy.setVerticalPolicy(QSizePolicy::Fixed);
    16. videoWidget->setSizePolicy(policy);
    17. videoWidget->setAspectRatio(Phonon::VideoWidget::AspectRatioAuto);
    18.  
    19. Phonon::createPath(mediaObject, videoWidget);
    20. QUrl url("output_1.avi");
    21.  
    22. mediaObject->setCurrentSource(url);
    23. mediaObject->setTickInterval(1000);
    24.  
    25. connect(mediaObject, SIGNAL(finished()), mediaObject, SLOT(deleteLater()));
    26. connect(ui->pause,SIGNAL(clicked()),mediaObject,SLOT(pause()));
    27. connect(ui->play,SIGNAL(clicked()),mediaObject,SLOT(play()));
    28. connect(ui->stop,SIGNAL(clicked()),mediaObject,SLOT(stop()));
    29. }
    To copy to clipboard, switch view to plain text mode 

    Thank You,

    Baluk

  6. #6
    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

    Looks like someone forgot to put the video widget in a layout.
    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.


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

    Default Re: VideoWidget problem

    Yes. Now I applied the layout.

    Qt Code:
    1. QHBoxLayout *hVideo = new QHBoxLayout(ui->frame);
    2. hVideo->addWidget(videoWidget);
    To copy to clipboard, switch view to plain text mode 

    But still the same result. I am attaching the image of my app output. So you can have a clear picture.

    Thank You,
    Baluk
    Attached Images Attached Images

  8. #8
    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

    What does sizeHint() of the video widget return during playback? Note, you have to query for it during playback, it won't return proper value otherwise.
    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.


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

    Default Re: VideoWidget problem

    oke. I did query the sizeHint(), it returns the QSize(640, 480). But its the same value returned for every video. What I thought is, it was returning the player(widget) size but not the video file size. I am not sure.

  10. #10
    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.


  11. #11
    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 

  12. #12
    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.


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.