From 8e8dab7a4d47eb62603de6aa872a98ca46cd0cef Mon Sep 17 00:00:00 2001 From: Marco Felsch Date: Wed, 31 Mar 2021 10:52:14 +0200 Subject: [PATCH] qmlglsink: allow to set force-aspect-ratio property Add the forceAspectRatio Q_PROPERTY to allow changing the aspect ratio from QML code as well. Part-of: --- ext/qt/qtitem.cc | 2 ++ ext/qt/qtitem.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/ext/qt/qtitem.cc b/ext/qt/qtitem.cc index da2b701908..5b23714c9d 100644 --- a/ext/qt/qtitem.cc +++ b/ext/qt/qtitem.cc @@ -184,6 +184,8 @@ void QtGLVideoItem::setForceAspectRatio(bool force_aspect_ratio) { this->priv->force_aspect_ratio = !!force_aspect_ratio; + + emit forceAspectRatioChanged(force_aspect_ratio); } bool diff --git a/ext/qt/qtitem.h b/ext/qt/qtitem.h index 065d043eaf..f2f67f7e8d 100644 --- a/ext/qt/qtitem.h +++ b/ext/qt/qtitem.h @@ -68,6 +68,10 @@ class QtGLVideoItem : public QQuickItem, protected QOpenGLFunctions Q_PROPERTY(bool itemInitialized READ itemInitialized NOTIFY itemInitializedChanged) + Q_PROPERTY(bool forceAspectRatio + READ getForceAspectRatio + WRITE setForceAspectRatio + NOTIFY forceAspectRatioChanged) public: QtGLVideoItem(); @@ -85,6 +89,7 @@ public: Q_SIGNALS: void itemInitializedChanged(); + void forceAspectRatioChanged(bool); private Q_SLOTS: void handleWindowChanged(QQuickWindow * win);