saman_artorious
11th July 2012, 10:51
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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <phonon/MediaObject>
#include <phonon/VideoPlayer>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
Phonon::MediaObject *media;
media = new Phonon::MediaObject();
media->setCurrentSource(Phonon::MediaSource(QString("/home/saman/4.7/phonon_test/sample.mp4")));
Phonon::VideoPlayer *videoPlayer;
videoPlayer = new Phonon::VideoPlayer(Phonon::VideoCategory);
videoPlayer->setFixedSize(QSize(400, 300));
videoPlayer->move(1280-400, 0);
videoPlayer->show();
connect(videoPlayer, SIGNAL(finished()), videoPlayer, SLOT(deleteLater()));
videoPlayer->play(media->currentSource());
}
MainWindow::~MainWindow()
{
delete ui;
}
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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <phonon/MediaObject>
#include <phonon/VideoPlayer>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
Phonon::MediaObject *media;
media = new Phonon::MediaObject();
media->setCurrentSource(Phonon::MediaSource(QString("/home/saman/4.7/phonon_test/sample.mp4")));
Phonon::VideoPlayer *videoPlayer;
videoPlayer = new Phonon::VideoPlayer(Phonon::VideoCategory);
videoPlayer->setFixedSize(QSize(400, 300));
videoPlayer->move(1280-400, 0);
videoPlayer->show();
connect(videoPlayer, SIGNAL(finished()), videoPlayer, SLOT(deleteLater()));
videoPlayer->play(media->currentSource());
}
MainWindow::~MainWindow()
{
delete ui;
}