Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

VideoWidget Class Reference
(Phonon::VideoWidget)
[Phonon module]

The VideoWidget class provides a widget that is used to display video. More...

 #include <Phonon/VideoWidget>

This class is not part of the Qt GUI Framework Edition.

Inherits QWidget and MediaNode.

This class was introduced in Qt 4.4.


Public Types

enum AspectRatio { AspectRatioAuto, AspectRatioWidget, AspectRatio4_3, AspectRatio16_9 }
enum ScaleMode { FitInView, ScaleAndCrop }

Properties

  • 58 properties inherited from QWidget
  • 1 property inherited from QObject

Public Functions

VideoWidget ( QWidget * parent = 0 )
AspectRatio aspectRatio () const
qreal brightness () const
qreal contrast () const
qreal hue () const
qreal saturation () const
ScaleMode scaleMode () const

Public Slots

void enterFullScreen ()
void exitFullScreen ()
void setAspectRatio ( AspectRatio )
void setBrightness ( qreal value )
void setContrast ( qreal value )
void setFullScreen ( bool fullscreen )
void setHue ( qreal value )
void setSaturation ( qreal value )
void setScaleMode ( ScaleMode )
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject

Reimplemented Protected Functions

virtual bool event ( QEvent * )
virtual void mouseMoveEvent ( QMouseEvent * )
  • 37 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice

Additional Inherited Members

  • 1 signal inherited from QWidget
  • 1 signal inherited from QObject
  • 4 static public members inherited from QWidget
  • 5 static public members inherited from QObject
  • 37 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice
  • 1 protected slot inherited from QWidget

Detailed Description

The VideoWidget class provides a widget that is used to display video.

The VideoWidget class renders the video of a media stream on a QWidget. It is connected to the MediaObject, of which video stream it should render. You connect the two objects using the Phonon::createPath() function.

The widget has some possibilities to manipulate the video stream. You can change the brightness(), hue(), saturation(), and contrast().

Resizing of the video is handled automatically, but you can affect the way the video is resized with the aspectRatio and scaleMode properties. By default, the widget will use the aspect ratio of the video stream itself.

The video widget takes the size of the video when it receives a new video stream (i.e., when a new MediaSource is set on the MediaObject to which it is connected). If you need to know the size of the video, you can call sizeHint() after the video has been loaded (i.e., after the MediaObject leaves the LoadingState).

It is also possible to go to full screen mode.

A typical example of usage follows below:

 MediaObject *media = new MediaObject(parent);
 VideoWidget *vwidget = new VideoWidget(parent);
 Phonon::createPath(media, vwidget);

See also Phonon Module.


Member Type Documentation

enum VideoWidget::AspectRatio

Defines the width:height to be used for the video.

ConstantValueDescription
Phonon::VideoWidget::AspectRatioAuto0Let the decoder find the aspect ratio automatically from the media file (this is the default).
Phonon::VideoWidget::AspectRatioWidget1Fits the video into the widget making the aspect ratio depend solely on the size of the widget. This way the aspect ratio is freely resizeable by the user.
Phonon::VideoWidget::AspectRatio4_32Make width/height == 4/3, which is the old TV size and monitor size (1024/768 == 4/3). (4:3)
Phonon::VideoWidget::AspectRatio16_93Make width/height == 16/9, which is the size of most current media. (16:9)

enum VideoWidget::ScaleMode

The ScaleMode enum describes how to treat aspect ratio during resizing of video.

ConstantValueDescription
Phonon::VideoWidget::FitInView0The video will be fitted to fill the view keeping aspect ratio.
Phonon::VideoWidget::ScaleAndCrop1The video is scaled


Property Documentation

aspectRatio : AspectRatio

Defaults to AspectRatioAuto.

Access functions:

AspectRatio aspectRatio () const
void setAspectRatio ( AspectRatio )

See also AspectRatio.

brightness : qreal

This property holds brightness of the video.

Default is 0. Acceptable values are in range of -1, 1.

Access functions:

qreal brightness () const
void setBrightness ( qreal value )

contrast : qreal

This property holds the contrast of the video.

Default is 0. Acceptable values are in range of -1, 1.

Access functions:

qreal contrast () const
void setContrast ( qreal value )

fullScreen : bool

This property holds whether the video is shown using the complete screen.

The property differs from QWidget::fullScreen in that it is writeable.

By default the widget is not shown in fullScreen.

Warning: When switching to full screen mode using setFullScreen(), the widget onto which the video is rendered is shown as a top-level window. Key event forwarding is handled by VideoWidget, but if you need to handle other events, e.g., mouse events, you should handle fullscreen mode yourself.

Access functions:

bool isFullScreen () const
void setFullScreen ( bool fullscreen )

hue : qreal

This property holds the hue of the video.

Default is 0. Acceptable values are in range of -1, 1.

Access functions:

qreal hue () const
void setHue ( qreal value )

saturation : qreal

This property holds saturation of the video.

Default is 0. Acceptable values are in range of -1, 1.

Access functions:

qreal saturation () const
void setSaturation ( qreal value )

scaleMode : ScaleMode

If the size of the widget and the size of the video are not equal. The video will be zoomed to fit the widget. The smaller zoom (AddBarsScaleMode) adds black bars at the left/right or top/bottom to make all of the image visible (default). The bigger zoom (ExpandMode) fills the widget completely, keeping all information in one direction and leaving parts of the image outside of the widget in the other direction.

Access functions:

ScaleMode scaleMode () const
void setScaleMode ( ScaleMode )

Member Function Documentation

VideoWidget::VideoWidget ( QWidget * parent = 0 )

Constructs a new video widget with the specified parent.

void VideoWidget::enterFullScreen ()   [slot]

Convenience slot, calling setFullScreen(true)

bool VideoWidget::event ( QEvent * )   [virtual protected]

Reimplemented from QObject::event().

void VideoWidget::exitFullScreen ()   [slot]

Convenience slot, calling setFullScreen(false)

void VideoWidget::mouseMoveEvent ( QMouseEvent * )   [virtual protected]

Reimplemented from QWidget::mouseMoveEvent().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 42
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 6
Page suivante

Le Qt Quarterly au hasard

Logo

Des apparences personnalisées utilisant les feuilles de style

Qt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.6
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web