GstQtOverlay plugin properties

From RidgeRun Developer Connection
Jump to: navigation, search


Previous: GstQtOverlay Overview/Capabilities Index Next: Getting Started






In this wiki, you can learn more about the GstQtOverlay plugin properties. GStreamer properties are used to customize the Qt image overlay, interact with QML and control the plugin operation.


Currently, GstQtOverlay has the following custom properties:

  • qml
  • qml-attribute
  • qml-clear-cache
  • disable

The next subsection provides details about how to use each property.

qml

The qml property specifies the location of the QML source file to use. This path can be either relative or absolute and must point to a valid/existing file at the moment the pipeline starts up. Some examples include:

 gst-launch-1.0 videotestsrc ! qtoverlay qml=/mnt/gui/sources/main.qml ! videoconvert ! autovideosink
 gst-launch-1.0 videotestsrc ! qtoverlay qml=../../sources/main.qml ! videoconvert ! autovideosink

If not specified, the element will attempt to load main.qml from the current working directory.

qml-attribute

QML attributes may be configured at runtime using the qml-attribute property. The property syntax is as follows:

 <item name>.<attribute name>:<value>

Item name refers to the QML objectName attribute of an item, rather than its ID. The following QML contains an item named labelMain:

 Label {
     text: "Way cool QT imaging with GStreamer!"
     font.pixelSize: 22
     font.italic: true
     color: "steelblue"
     objectName: "labelMain"
 }

For example, to modify the text attribute of a label named labelMain to display GStreamer with QT imaging is way cool! you would run:

 gstd-client element_set qtoverlay qml-attribute "labelMain.text:GStreamer with QT imaging is way cool!"

The qml-attribute will recursively traverse the objects tree to find all the items in the hierarchy with the given objectName.

The objectName attribute is not required to be unique, so multiple items can be modified at once by assigning them the same objectName.

qml-action property

External events can also trigger actions on the QML by using the qml-action property. Similarly, the syntax goes as the following:

<item name>.<method name>()

Again, the qml-action will recursively traverse the objects tree to find all the items in the hierarchy with the given objectName.

For example, consider the following QML snippet:

import QtQuick 2.0

Item {
    objectName:i1
    function sayHi() {
        console.log("Hello World!")
    }
}

To invoke sayHi you would run:

gstd-client element_set qtoverlay qml-action "i1.sayHi()"

At this time, passing parameters to the invoked functions is not supported. Instead, first set an attribute value, then invoke the function which can access the attribute. There are future plans to support function parameters via Variants or some similar mechanism.


Previous: GstQtOverlay Overview/Capabilities Index Next: Getting Started