|  | Home · All Namespaces · All Classes · Main Classes · Grouped Classes · Modules · Functions |

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

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

     #include <Phonon>

Inherits QWidget and MediaNode.

This class was introduced in Qt 4.4.

- List of all members, including inherited members

### Public Types

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

### Properties

aspectRatio : AspectRatio brightness : qreal contrast : qreal fullScreen : bool | hue : qreal saturation : qreal scaleMode : ScaleMode

- 57 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

- 206 public functions inherited from QWidget
- 3 public functions inherited from Phonon::MediaNode
- 29 public functions inherited from QObject
- 12 public functions inherited from QPaintDevice

### 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

### Protected Functions

- VideoWidget ( VideoWidgetPrivate & d, QWidget * parent )
- virtual bool event ( QEvent * )
- virtual void mouseMoveEvent ( QMouseEvent * )

- 38 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
- 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().

The widget can resize the video to fit the widget, the AspectRatio is kept during resizing. It is also possible to go to fullScreen() mode. 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).

A typical example of usage follows below:

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

Author: Matthias Kretz <kretz@kde.org>

## Member Type Documentation

### enum VideoWidget::AspectRatio

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

Constant | Value | Description
--- | --- | ---
`Phonon::VideoWidget::AspectRatioAuto` | `0` | Let the decoder find the aspect ratio automatically from the media file (this is the default).
`Phonon::VideoWidget::AspectRatioWidget` | `1` | Fits 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_3` | `2` | Make width/height == 4/3, which is the old TV size and monitor size (1024/768 == 4/3). (4:3)
`Phonon::VideoWidget::AspectRatio16_9` | `3` | Make 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.

Constant | Value | Description
--- | --- | ---
`Phonon::VideoWidget::FitInView` | `0` | The video will be fitted to fill the view keeping aspect ratio.
`Phonon::VideoWidget::ScaleAndCrop` | `1` | The 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 the video to fullscreen using setFullScreen your application loses control over the widget that actually shows the video (which is then shown as a toplevel window while your application still uses this widget). If you only need to capture key events the event forwarding done internally should suffice for your needs. If you need to map mouse coordinates or add widgets (that are not overlays) you should probably handle fullscreen 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 a parent.

### VideoWidget::VideoWidget ( VideoWidgetPrivate & d, QWidget * parent ) `[protected]`

### void VideoWidget::enterFullScreen () `[slot]`

Convenience slot, calling setFullScreen(true)

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

### void VideoWidget::exitFullScreen () `[slot]`

Convenience slot, calling setFullScreen(false)

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