QtMobility Reference Documentation

Contents

QML ValueSpacePublisher Element

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

  • List of all members, including inherited members
  • 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.


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


    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.


    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.


    value : QVariant

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