QVideoWidget Class
La clase QVideoWidget proporciona un widget que muestra el vídeo generado por un objeto multimedia. Más información...
| Encabezado: | #include <qvideowidget.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS MultimediaWidgets) target_link_libraries(mytarget PRIVATE Qt6::MultimediaWidgets) |
| qmake: | QT += multimediawidgets |
| Heredado de: | QWidget |
Propiedades
- aspectRatioMode : Qt::AspectRatioMode
- fullScreen : bool
Funciones públicas
| QVideoWidget(QWidget *parent = nullptr) | |
| virtual | ~QVideoWidget() override |
| Qt::AspectRatioMode | aspectRatioMode() const |
| bool | isFullScreen() const |
| QVideoSink * | videoSink() const |
Funciones públicas reimplementadas
| virtual QSize | sizeHint() const override |
Ranuras públicas
| void | setAspectRatioMode(Qt::AspectRatioMode mode) |
| void | setFullScreen(bool fullScreen) |
Señales
| void | aspectRatioModeChanged(Qt::AspectRatioMode mode) |
| void | fullScreenChanged(bool fullScreen) |
Funciones protegidas reimplementadas
| 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 |
Descripción detallada
Al asociar un `QVideoWidget` a un ` QMediaPlayer ` o un ` QCamera `, este podrá mostrar la salida de vídeo o imagen de dicho objeto.
player = new QMediaPlayer;
player->setSource(QUrl("http://example.com/myclip1.mp4"));
videoWidget = new QVideoWidget;
player->setVideoOutput(videoWidget);
videoWidget->show();
player->play();Nota: Solo se puede asociar una salida de visualización a un objeto multimedia a la vez.
Advertencia: QVideoWidget no es compatible con el complemento de la plataforma eglfs.
Véase también QCamera, QMediaPlayer y QGraphicsVideoItem.
Documentación de propiedades
aspectRatioMode : Qt::AspectRatioMode
cómo se redimensiona el vídeo en función de su relación de aspecto.
Funciones de acceso:
| Qt::AspectRatioMode | aspectRatioMode() const |
| void | setAspectRatioMode(Qt::AspectRatioMode mode) |
Señal de notificador:
| void | aspectRatioModeChanged(Qt::AspectRatioMode mode) |
fullScreen : bool
Esta propiedad indica si la visualización del vídeo se limita a una ventana o se muestra a pantalla completa.
Funciones de acceso:
| bool | isFullScreen() const |
| void | setFullScreen(bool fullScreen) |
Señal de notificador:
| void | fullScreenChanged(bool fullScreen) |
Documentación de las funciones de miembro
[explicit] QVideoWidget::QVideoWidget(QWidget *parent = nullptr)
Crea un nuevo widget de vídeo.
El objeto ` parent ` se pasa a ` QWidget`.
[override virtual noexcept] QVideoWidget::~QVideoWidget()
Elimina un widget de vídeo.
[override virtual protected] bool QVideoWidget::event(QEvent *event)
Reimplementa: ` QWidget::event(QEvent *event)`.
Evento actual event. Devuelve el valor de la función de la clase base QWidget::event(QEvent *event).
[override virtual protected] void QVideoWidget::hideEvent(QHideEvent *event)
Reimplementa: QWidget::hideEvent(QHideEvent *event).
Gestiona el evento de ocultación event.
[override virtual protected] void QVideoWidget::moveEvent(QMoveEvent *event)
Reimplementa: ` QWidget::moveEvent(QMoveEvent *event)`.
Gestiona el movimiento event.
[override virtual protected] void QVideoWidget::resizeEvent(QResizeEvent *event)
Reimplementa: QWidget::resizeEvent(QResizeEvent *event).
Gestiona el cambio de tamaño de « event ».
[override virtual protected] void QVideoWidget::showEvent(QShowEvent *event)
Reimplementa: QWidget::showEvent(QShowEvent *event).
Gestiona el evento « event ».
[override virtual] QSize QVideoWidget::sizeHint() const
Reimplementa una función de acceso para la propiedad: QWidget::sizeHint.
Devuelve la sugerencia de tamaño para el back-end actual, si la hay; de lo contrario, devuelve la sugerencia de tamaño de QWidget.
[invokable] QVideoSink *QVideoWidget::videoSink() const
Devuelve la instancia de ` QVideoSink `.
Nota: Esta función se puede invocar a través del sistema de metaobjetos y desde QML. Véase Q_INVOKABLE.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.