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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/937>
This commit is contained in:
Marco Felsch 2021-03-31 10:52:14 +02:00 committed by GStreamer Marge Bot
parent 63c1e2ed60
commit 8e8dab7a4d
2 changed files with 7 additions and 0 deletions

View file

@ -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

View file

@ -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);