QVideoWidget Class
La clase QVideoWidget proporciona un widget que presenta vídeo producido por un objeto multimedia. Más...
| Cabecera: | #include <QVideoWidget> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS MultimediaWidgets)target_link_libraries(mytarget PRIVATE Qt6::MultimediaWidgets) |
| qmake: | QT += multimediawidgets |
| Hereda: | 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
Adjuntar un QVideoWidget a un QMediaPlayer o QCamera le permite mostrar la salida de vídeo o imagen de ese objeto.
player = new QMediaPlayer; player->setSource(QUrl("http://example.com/myclip1.mp4")); videoWidget = new QVideoWidget; player->setVideoOutput(videoWidget); videoWidget->show(); player->play();
Nota: Sólo se puede adjuntar una única salida de visualización a un objeto multimedia a la vez.
Advertencia: QVideoWidget no es compatible con el plugin de plataforma eglfs.
Ver también QCamera, QMediaPlayer, y QGraphicsVideoItem.
Documentación de propiedades
aspectRatioMode : Qt::AspectRatioMode
cómo se escala el vídeo con respecto a su relación de aspecto.
Funciones de acceso:
| Qt::AspectRatioMode | aspectRatioMode() const |
| void | setAspectRatioMode(Qt::AspectRatioMode mode) |
Notificador de señal:
| void | aspectRatioModeChanged(Qt::AspectRatioMode mode) |
fullScreen : bool
Esta propiedad indica si la visualización de vídeo se limita a una ventana o es a pantalla completa.
Funciones de acceso:
| bool | isFullScreen() const |
| void | setFullScreen(bool fullScreen) |
Señal del notificador:
| void | fullScreenChanged(bool fullScreen) |
Documentación de las funciones miembro
[explicit] QVideoWidget::QVideoWidget(QWidget *parent = nullptr)
Crea un nuevo widget de vídeo.
El parent se pasa a QWidget.
[override virtual noexcept] QVideoWidget::~QVideoWidget()
Destruye 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).
Maneja la ocultación event.
[override virtual protected] void QVideoWidget::moveEvent(QMoveEvent *event)
Reimplementa: QWidget::moveEvent(QMoveEvent *event).
Maneja el movimiento event.
[override virtual protected] void QVideoWidget::resizeEvent(QResizeEvent *event)
Reimplementa: QWidget::resizeEvent(QResizeEvent *event).
Maneja el cambio de tamaño event.
[override virtual protected] void QVideoWidget::showEvent(QShowEvent *event)
Reimplementa: QWidget::showEvent(QShowEvent *event).
Maneja el show 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 backend actual, si existe, o bien la sugerencia de tamaño de QWidget.
[invokable] QVideoSink *QVideoWidget::videoSink() const
Devuelve la instancia QVideoSink.
Nota: Esta función puede invocarse 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.