PySide6.QtMultimediaWidgets.QVideoWidget

class QVideoWidget

QVideoWidget 类提供了一个用于显示由媒体对象生成的视频的小部件。更多

PySide6.QtMultimediaWidgets.QVideoWidget 的继承图

概要

属性

方法

插槽

信号

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

警告

本节包含从C++自动翻译到Python的代码片段,可能包含错误。

QVideoWidget附加到QMediaPlayerQCamera上,可以显示该对象的视频或图像输出。

player = QMediaPlayer()
player.setSource(QUrl("http://example.com/myclip1.mp4"))
videoWidget = QVideoWidget()
player.setVideoOutput(videoWidget)
videoWidget.show()
player.play()

注意: 一次只能将一个显示输出附加到媒体对象上。

注意

当使用from __feature__ import true_property时,属性可以直接使用,否则通过访问器函数使用。

property aspectRatioModeᅟ: Qt.AspectRatioMode

此属性决定了视频如何根据其宽高比进行缩放。

Access functions:
property fullScreenᅟ: bool

此属性决定视频显示是限制在窗口内还是全屏显示。

Access functions:
__init__([parent=None])
Parameters:

父级QWidget

构建一个新的视频小部件。

parent 被传递给 QWidget。

aspectRatioMode()
Return type:

AspectRatioMode

另请参阅

setAspectRatioMode()

属性 aspectRatioModeᅟ 的获取器。

aspectRatioModeChanged(mode)
Parameters:

模式AspectRatioMode

属性 aspectRatioModeᅟ 的通知信号。

fullScreenChanged(fullScreen)
Parameters:

fullScreen – 布尔值

属性 fullScreenᅟ 的通知信号。

setAspectRatioMode(mode)
Parameters:

模式AspectRatioMode

另请参阅

aspectRatioMode()

属性 aspectRatioModeᅟ 的设置器。

setFullScreen(fullScreen)
Parameters:

fullScreen – 布尔值

另请参阅

isFullScreen()

属性 fullScreenᅟ 的设置器。

videoSink()
Return type:

QVideoSink

返回QVideoSink实例。