Hi everyone, recently qt 4.7.0 tp has released and it intrtroduces a lot of new stuff. One thing i'm really exited about is that Qt now supports video playback natively by QMultimedia Module.

However, when i embed a QVideoWidget which connects to a QMediaPlayer into QGraphicsScene, the video just do not show up in the QGraphicsView while i do can hear the sound in the video?

Does anyone have a solution? Thanks a lot

the following is a part of my code:

Qt Code:
  1. class MovieInfoViewer : public QMainWindow
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. MovieInfoViewer(QWidget *parent = 0, Qt::WFlags flags = 0);
  7. ~MovieInfoViewer();
  8.  
  9. private:
  10. Ui::MovieInfoViewerClass ui;
  11.  
  12. QGraphicsScene* pMainScene;
  13. QVideoWidget* pBackGroundVideoWidget;
  14. QMediaPlayer* pBackGroundVideoPlayer;
  15. };
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. MovieInfoViewer::MovieInfoViewer(QWidget *parent, Qt::WFlags flags)
  2. : QMainWindow(parent, flags)
  3. {
  4. ui.setupUi(this);
  5.  
  6. pMainScene=new QGraphicsScene();
  7. pBackGroundVideoWidget=new QVideoWidget();
  8. pBackGroundVideoPlayer=new QMediaPlayer();
  9.  
  10. pBackGroundVideoWidget->setMediaObject(pBackGroundVideoPlayer);
  11.  
  12. pBackGroundVideoPlayer->setMedia(QUrl::fromLocalFile("bTest.wmv"));
  13. pBackGroundVideoPlayer->setVolume(100);
  14. pBackGroundVideoPlayer->play();
  15.  
  16. pMainScene->addWidget(pBackGroundVideoWidget);
  17.  
  18. ui.mainView->setScene(pMainScene);
  19. ui.mainView->show();
  20. }
To copy to clipboard, switch view to plain text mode