Use QVideoWidget in the videowidget example.

The videowidget example now uses QVideoWidget instead of a custom
QAbstractVideoSurface, the former being the most straightforward and
fastest way of showing a video in a QWidget.

The old code has been moved to a new example: "customvideosurface".

Change-Id: I15fb4482d0e77bafd24d4cb03316fc8f4ef13c35
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Jason Barron <jason.barron@digia.com>
This commit is contained in:
Yoann Lopes
2012-09-25 16:58:44 +02:00
committed by The Qt Project
parent b5fb793b9a
commit 28c053ccad
12 changed files with 304 additions and 11 deletions

View File

@@ -40,9 +40,8 @@
#include "videoplayer.h"
#include "videowidget.h"
#include <QtWidgets>
#include <qvideowidget.h>
#include <qvideosurfaceformat.h>
VideoPlayer::VideoPlayer(QWidget *parent)
@@ -51,7 +50,7 @@ VideoPlayer::VideoPlayer(QWidget *parent)
, playButton(0)
, positionSlider(0)
{
VideoWidget *videoWidget = new VideoWidget;
QVideoWidget *videoWidget = new QVideoWidget;
QAbstractButton *openButton = new QPushButton(tr("Open..."));
connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));
@@ -81,7 +80,7 @@ VideoPlayer::VideoPlayer(QWidget *parent)
setLayout(layout);
mediaPlayer.setVideoOutput(videoWidget->videoSurface());
mediaPlayer.setVideoOutput(videoWidget);
connect(&mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)),
this, SLOT(mediaStateChanged(QMediaPlayer::State)));
connect(&mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));