QtMobility Reference Documentation

QML ValueSpacePublisher Element

The ValueSpacePublisher element represents a path in the value space where keys can be published. More...

This element was introduced in Mobility 1.2.

Properties

Detailed Description

ValueSpacePublishers are constructed with a set path which cannot be changed. If you need to publish within multiple different paths, you will need multiple ValueSpacePublishers.

For the keys within the path chosen, if the key names to be published are alphanumeric, they may be accessed through dynamic properties by setting the keys list.

Example:

 ValueSpacePublisher {
     id: battery
     path: "/power/battery"
     keys: ["charge", "charging"]
 }

 MouseArea {
     onClicked: {
         battery.charge = 50
         battery.charging = true
     }
 }

Alternatively, for key names that can't be mapped to properties, or for key names shadowed by existing properties (like "value" or "path"), you can also access the value property of the Publisher itself.

 ValueSpacePublisher {
     id: nonalpha
     path: "/something/with a space/value"
 }

 MouseArea {
     onClicked: {
         nonalpha.value = "example"
     }
 }

The ValueSpacePublisher element is part of the QtMobility.publishsubscribe 1.2 module.

See also QValueSpacePublisher.

Property Documentation

read-onlyhasSubscribers : bool

This property is true if there are subscribers currently subscribed to the ValueSpace path being published by this Publisher.

This property is read only.

This property group was introduced in Mobility 1.2.


Setting this property creates a set of dynamic properties allowing easy access to set the values of keys under this Publisher's path.

This property group was introduced in Mobility 1.2.


path : string

This property holds the base path of the publisher. This property is write-once -- after the first write, subsequent writes will be ignored and produce a warning.

This property group was introduced in Mobility 1.2.


server : bool

This property can be used to force the Publisher to start the ValueSpace server (if one is appropriate on the platform) before the path property has been set.

This property is write only.

This property group was introduced in Mobility 1.2.


value : QVariant

This property publishes a new value to the ValueSpace at the path given through the path property. This property is write only.

This property group was introduced in Mobility 1.2.


X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.