Hi everyone,

I'm back with a new question.
I have a dialog box which has a button to call QFileDialog::getOpenFileName() to choose a video file.
And the Phonon::VideoPlayer will use the path to play the video.
Now I want to get the width and height of the video. After some searching I try to use VideoPlayer->sizeHint()to get the size while the path is set. The code is like:

Qt Code:
  1. void VideoDialog::addVideo() // A slot called by clicked() signal of the button
  2. {
  3. QMessageBox::warning(this, tr("0"), QString::number(m_videoPlayer->sizeHint().width()) + " x " + QString::number(m_videoPlayer->sizeHint().height()));
  4. QString videoFile = QFileDialog::getOpenFileName(.....); // The function arguments are removed
  5. if(!videoFile.isEmpty()){
  6. m_videoPlayer->mediaObject()->clear();
  7. m_videoPlayer->mediaObject()->setCurrentSource(videoFile);
  8. QMessageBox::warning(this, tr("1"), QString::number(m_videoPlayer->sizeHint().width()) + " x " + QString::number(m_videoPlayer->sizeHint().height()));
  9. }
  10. }
To copy to clipboard, switch view to plain text mode 

The problem I met is that after I set the video path, the sizeHint is not updated. But if I press the button again, the sizeHint will be the right value. Is there a way to get the sizeHint immediately?
Thanks in advance.