Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

QVideoWidget Class

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

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


Public Functions

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

Reimplemented Public Functions

virtual QSize sizeHint() const override

Public Slots

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


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

Reimplemented Protected Functions

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

Detailed Description

Attaching a QVideoWidget to a QMediaPlayer or QCamera allows it to display the video or image output of that object.

player = new QMediaPlayer;

videoWidget = new QVideoWidget;


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

See also QCamera, QMediaPlayer, and QGraphicsVideoItem.

Property Documentation

aspectRatioMode : Qt::AspectRatioMode

how video is scaled with respect to its aspect ratio.

Access functions:

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

Notifier signal:

void aspectRatioModeChanged(Qt::AspectRatioMode mode)

fullScreen : bool

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

Access functions:

bool isFullScreen() const
void setFullScreen(bool fullScreen)

Notifier signal:

void fullScreenChanged(bool fullScreen)

Member Function Documentation

QVideoWidget::QVideoWidget(QWidget *parent = nullptr)

Constructs a new video widget.

The parent is passed to QWidget.

[virtual] QVideoWidget::~QVideoWidget()

Destroys a video widget.

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

Reimplements: QWidget::event(QEvent *event).

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

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

Reimplements: QWidget::hideEvent(QHideEvent *event).

Handles the hide event.

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

Reimplements: QWidget::moveEvent(QMoveEvent *event).

Handles the move event.

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

Reimplements: QWidget::resizeEvent(QResizeEvent *event).

Handles the resize event.

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

Reimplements: QWidget::showEvent(QShowEvent *event).

Handles the show event.

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

Reimplements an access function for property: QWidget::sizeHint.

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

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

Returns the QVideoSink instance.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded