QVideoWidget 类

QVideoWidget 类提供呈现媒体对象产生视频的小部件。 更多...

头: #include <QVideoWidget>
CMake: find_package(Qt6 REQUIRED COMPONENTS MultimediaWidgets)
target_link_libraries(mytarget PRIVATE Qt6::MultimediaWidgets)
qmake: QT += multimediawidgets
继承: QWidget

特性

公共函数

QVideoWidget (QWidget * parent = nullptr)
virtual ~QVideoWidget ()
Qt::AspectRatioMode aspectRatioMode () const
bool isFullScreen () const
QVideoSink * videoSink () const

重实现公共函数

virtual QSize sizeHint () const override

公共槽

void setAspectRatioMode (Qt::AspectRatioMode mode )
void setFullScreen (bool fullScreen )

信号

void aspectRatioModeChanged (Qt::AspectRatioMode mode )
void fullScreenChanged (bool fullScreen )

重实现保护函数

virtual bool event (QEvent * event ) override
virtual void hideEvent (QHideEvent * event ) override
virtual void moveEvent (QMoveEvent * event ) override
virtual void resizeEvent (QResizeEvent * event ) override
virtual void showEvent (QShowEvent * event ) override

详细描述

附加 QVideoWidget 到 QMediaPlayer or QCamera 允许它显示该对象的视频 (或图像输出)。

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

注意 :每次只可以把单个显示输出附加到媒体对象。

另请参阅 QCamera , QMediaPlayer ,和 QGraphicsVideoItem .

特性文档编制

aspectRatioMode : Qt::AspectRatioMode

视频如何比例缩放根据其宽高比。

访问函数:

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

通知程序信号:

void aspectRatioModeChanged (Qt::AspectRatioMode mode )

fullScreen : bool

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

访问函数:

bool isFullScreen () const
void setFullScreen (bool fullScreen )

通知程序信号:

void fullScreenChanged (bool fullScreen )

成员函数文档编制

[explicit] QVideoWidget:: QVideoWidget ( QWidget * parent = nullptr)

构造新视频小部件。

The parent 会被传递给 QWidget .

[virtual noexcept] QVideoWidget:: ~QVideoWidget ()

销毁视频小部件。

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

重实现: QWidget::event (QEvent *event).

当前事件 event . Returns the value of the base class QWidget::event ( QEvent *event) 函数。

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

重实现: QWidget::hideEvent (QHideEvent *event).

处理隐藏 event .

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

重实现: QWidget::moveEvent (QMoveEvent *event).

处理移动 event .

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

重实现: QWidget::resizeEvent (QResizeEvent *event).

处理重置尺寸 event .

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

重实现: QWidget::showEvent (QShowEvent *event).

处理展示 event .

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

重实现访问函数为特性: QWidget::sizeHint .

返回用于当前后端的大小提示 (若有一个的话),否则大小提示来自 QWidget .

[invokable] QVideoSink *QVideoWidget:: videoSink () const

返回 QVideoSink 实例。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .