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 allows it to display the video or image output of that object.

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

此特性保持視頻顯示是局限於窗口,還是全屏。

訪問函數:

bool isFullScreen () const
void setFullScreen (bool fullScreen )

通知程序信號:

void fullScreenChanged (bool fullScreen )

成員函數文檔編製

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

構造新視頻小部件。

The parent 被傳遞給 QWidget .

[虛擬] 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 .

返迴用於當前後端的大小提示 (若有 1 個),否則大小提示來自 QWidget .

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

返迴 QVideoSink 實例。

注意: 此函數可以被援引,通過元對象係統和從 QML。見 Q_INVOKABLE .