QVideoWidget Class

The QVideoWidget class provides a widget which presents video produced by a media object. 更多...

头文件: #include <QVideoWidget>
qmake: QT += multimediawidgets
基类: QWidget and QMediaBindableInterface
派生类:

QCameraViewfinder

属性

公有函数

QVideoWidget(QWidget *parent = Q_NULLPTR)
~QVideoWidget()
Qt::AspectRatioMode aspectRatioMode() const
int brightness() const
int contrast() const
int hue() const
bool isFullScreen() const
int saturation() const

重新实现的公有函数

virtual QMediaObject *mediaObject() const override
virtual QSize sizeHint() const override

公有槽函数

void setAspectRatioMode(Qt::AspectRatioMode mode)
void setBrightness(int brightness)
void setContrast(int contrast)
void setFullScreen(bool fullScreen)
void setHue(int hue)
void setSaturation(int saturation)
  • 19 个公有槽函数继承自 QWidget

信号

void brightnessChanged(int brightness)
void contrastChanged(int contrast)
void fullScreenChanged(bool fullScreen)
void hueChanged(int hue)
void saturationChanged(int saturation)

受保护的函数

bool event(QEvent *event) override

重新实现的受保护函数

virtual void hideEvent(QHideEvent *event) override
virtual void moveEvent(QMoveEvent *event) override
virtual void paintEvent(QPaintEvent *event) override
virtual void resizeEvent(QResizeEvent *event) override
virtual void showEvent(QShowEvent *event) override

其他继承的成员

  • 5 个静态公有成员继承自 QWidget
  • 1 个受保护的槽函数继承自 QWidget

详细描述

The QVideoWidget class provides a widget which presents video produced by a media object.

Attaching a QVideoWidget to a QMediaObject allows it to display the video or image output of that media object. A QVideoWidget is attached to media object by passing a pointer to the QMediaObject in its constructor, and detached by destroying the QVideoWidget.


  player = new QMediaPlayer;

  playlist = new QMediaPlaylist(player);
  playlist->addMedia(QUrl("http://example.com/myclip1.mp4"));
  playlist->addMedia(QUrl("http://example.com/myclip2.mp4"));

  videoWidget = new QVideoWidget;
  player->setVideoOutput(videoWidget);

  videoWidget->show();
  playlist->setCurrentIndex(1);
  player->play();

Note: Only a single display output can be attached to a media object at one time.

参见 QMediaObject, QMediaPlayer, and QGraphicsVideoItem.

属性

aspectRatioMode : Qt::AspectRatioMode

how video is scaled with respect to its aspect ratio.

访问函数:

Qt::AspectRatioMode aspectRatioMode() const
void setAspectRatioMode(Qt::AspectRatioMode mode)

brightness : int

This property holds an adjustment to the brightness of displayed video.

Valid brightness values range between -100 and 100, the default is 0.

访问函数:

int brightness() const
void setBrightness(int brightness)

Notifier signal:

void brightnessChanged(int brightness)

contrast : int

This property holds an adjustment to the contrast of displayed video.

Valid contrast values range between -100 and 100, the default is 0.

访问函数:

int contrast() const
void setContrast(int contrast)

Notifier signal:

void contrastChanged(int contrast)

fullScreen : bool

This property holds whether video display is confined to a window or is fullScreen.

访问函数:

bool isFullScreen() const
void setFullScreen(bool fullScreen)

Notifier signal:

void fullScreenChanged(bool fullScreen)

hue : int

This property holds an adjustment to the hue of displayed video.

Valid hue values range between -100 and 100, the default is 0.

访问函数:

int hue() const
void setHue(int hue)

Notifier signal:

void hueChanged(int hue)

mediaObject : QMediaObject * const

This property holds the media object which provides the video displayed by a widget.

访问函数:

virtual QMediaObject *mediaObject() const override

saturation : int

This property holds an adjustment to the saturation of displayed video.

Valid saturation values range between -100 and 100, the default is 0.

访问函数:

int saturation() const
void setSaturation(int saturation)

Notifier signal:

void saturationChanged(int saturation)

成员函数

QVideoWidget::QVideoWidget(QWidget *parent = Q_NULLPTR)

Constructs a new video widget.

The parent is passed to QWidget.

QVideoWidget::~QVideoWidget()

Destroys a video widget.

[signal] void QVideoWidget::brightnessChanged(int brightness)

Signals that a video widgets's brightness adjustment has changed.

Note: Notifier signal for property brightness.

参见 brightness().

[signal] void QVideoWidget::contrastChanged(int contrast)

Signals that a video widgets's contrast adjustment has changed.

Note: Notifier signal for property contrast.

参见 contrast().

[protected] bool QVideoWidget::event(QEvent *event)

Current event event. Returns the value of the baseclass QWidget::event(QEvent *event) function.

[signal] void QVideoWidget::fullScreenChanged(bool fullScreen)

Signals that the fullScreen mode of a video widget has changed.

Note: Notifier signal for property fullScreen.

参见 isFullScreen().

[override virtual protected] void QVideoWidget::hideEvent(QHideEvent *event)

Reimplemented from QWidget::hideEvent().

Handles the hide event.

[signal] void QVideoWidget::hueChanged(int hue)

Signals that a video widgets's hue has changed.

Note: Notifier signal for property hue.

参见 hue().

[override virtual protected] void QVideoWidget::moveEvent(QMoveEvent *event)

Reimplemented from QWidget::moveEvent().

Handles the move event.

[override virtual protected] void QVideoWidget::paintEvent(QPaintEvent *event)

Reimplemented from QWidget::paintEvent().

Handles the paint event.

[override virtual protected] void QVideoWidget::resizeEvent(QResizeEvent *event)

Reimplemented from QWidget::resizeEvent().

Handles the resize event.

[signal] void QVideoWidget::saturationChanged(int saturation)

Signals that a video widgets's saturation has changed.

Note: Notifier signal for property saturation.

参见 saturation().

[override virtual protected] void QVideoWidget::showEvent(QShowEvent *event)

Reimplemented from QWidget::showEvent().

Handles the show event.

[override virtual] QSize QVideoWidget::sizeHint() const

Reimplemented from QWidget::sizeHint().

Returns the size hint for the current back end, if there is one, or else the size hint from QWidget.