
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheVideoWidget class provides a widget that is used to display video.More...
| enum | AspectRatio { AspectRatioAuto, AspectRatioWidget, AspectRatio4_3, AspectRatio16_9 } |
| enum | ScaleMode { FitInView, ScaleAndCrop } |
|
|
| VideoWidget(QWidget * parent = 0) | |
| AspectRatio | aspectRatio() const |
| qreal | brightness() const |
| qreal | contrast() const |
| qreal | hue() const |
| qreal | saturation() const |
| ScaleMode | scaleMode() const |
| QImage | snapshot() const |
| 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) |
| virtual bool | event(QEvent *) |
| virtual void | mouseMoveEvent(QMouseEvent *) |
TheVideoWidget class provides a widget that is used to display video.
TheVideoWidget class renders the video of a media stream on aQWidget. It is connected to theMediaObject, 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 thebrightness(),hue(),saturation(), andcontrast().
Resizing of the video is handled automatically, but you can affect the way the video is resized with theaspectRatio andscaleMode 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 newMediaSource is set on theMediaObject to which it is connected). If you need to know the size of the video, you can callsizeHint() after the video has been loaded (i.e., after theMediaObject leaves theLoadingState).
It is also possible to go tofull screen mode.
A typical example of usage follows below:
MediaObject*media=new MediaObject(parent);VideoWidget*vwidget=new VideoWidget(parent);Phonon::createPath(media, vwidget);
See alsoPhonon Module.
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) |
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 |
Defaults toAspectRatioAuto.
Access functions:
| AspectRatio | aspectRatio() const |
| void | setAspectRatio(AspectRatio) |
See alsoAspectRatio.
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) |
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) |
This property holds whether the video is shown using the complete screen.
The property differs fromQWidget::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 byVideoWidget, 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) |
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) |
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) |
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) |
Constructs a new video widget with the specifiedparent.
[slot]void VideoWidget::enterFullScreen()Convenience slot, callingsetFullScreen(true)
[virtual protected]bool VideoWidget::event(QEvent *)Reimplemented fromQObject::event().
[slot]void VideoWidget::exitFullScreen()Convenience slot, callingsetFullScreen(false)
[virtual protected]void VideoWidget::mouseMoveEvent(QMouseEvent *)Reimplemented fromQWidget::mouseMoveEvent().
Returns a snapshot of the current frame shown in the widget.
This function was introduced in Qt 4.7.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.