Hi,

the following code creates a video player object and shows mp4 video in a seperate window. Though, this is not exactly what i want.
I need to create a movie widget inside the main window, should be located in the middle, with some buttons n slider added to the other sides of it.

As, I am new to Qt graphics, I don't know what to add to this code.
would anyone help me revising the code please.

Yours

Qt Code:
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3.  
  4. #include <phonon/MediaObject>
  5. #include <phonon/VideoPlayer>
  6.  
  7. MainWindow::MainWindow(QWidget *parent) :
  8. QMainWindow(parent),
  9. ui(new Ui::MainWindow)
  10. {
  11. ui->setupUi(this);
  12.  
  13. Phonon::MediaObject *media;
  14.  
  15. media = new Phonon::MediaObject();
  16. media->setCurrentSource(Phonon::MediaSource(QString("/home/saman/4.7/phonon_test/sample.mp4")));
  17.  
  18. Phonon::VideoPlayer *videoPlayer;
  19.  
  20. videoPlayer = new Phonon::VideoPlayer(Phonon::VideoCategory);
  21. videoPlayer->setFixedSize(QSize(400, 300));
  22. videoPlayer->move(1280-400, 0);
  23. videoPlayer->show();
  24.  
  25. connect(videoPlayer, SIGNAL(finished()), videoPlayer, SLOT(deleteLater()));
  26. videoPlayer->play(media->currentSource());
  27. }
  28.  
  29. MainWindow::~MainWindow()
  30. {
  31. delete ui;
  32. }
To copy to clipboard, switch view to plain text mode