QValueSpaceSubscriber Class ReferenceThe QValueSpaceSubscriber class allows applications to read and subscribe to Value Space paths. More... #include <QValueSpaceSubscriber> Inherits QObject. Properties
Public Functions
Signals
Additional Inherited Members
Detailed DescriptionThe QValueSpaceSubscriber class allows applications to read and subscribe to Value Space paths. By default QValueSpaceSubscriber can read values from and report change notifications for all available Value Space layers. Only data from the layer with the highest order and that contains the specific key is returned by this class. The layers that QValueSpaceSubscriber accesses can be limited by specifying either a filter or a QUuid at construction time. Applications subscribe to a particular path in the Value Space. If anything under that path changes the contextChanged() signal is emitted. For example given the schema: /Device/Buttons = 3 /Device/Buttons/1/Name = Menu /Device/Buttons/1/Usable = true /Device/Buttons/2/Name = Select /Device/Buttons/2/Usable = false /Device/Buttons/3/Name = Back /Device/Buttons/3/Usable = true The code: QValueSpaceSubscriber *buttons = new QValueSpaceSubscriber("/Device/Buttons"); QObject::connect(buttons, SIGNAL(contentsChanged()), this, SLOT(buttonInfoChanged())); will invoke the buttonInfoChanged() slot whenever any value under /Device/Buttons changes. This includes the value of /Device/Buttons itself, a change of a subpath such as /Device/Buttons/2/Name or the creation or removal of a subpath. Property Documentation
|
QString | path () const |
void | setPath ( const QString & path ) |
void | setPath ( QValueSpaceSubscriber * subscriber ) |
This property holds the value of the path that this QValueSpaceSubscriber refers to.
Notifier signal:
void | contentsChanged () |
Constructs a QValueSpaceSubscriber with the specified parent that refers to the root path.
The constructed Value Space subscriber will access all available QAbstractValueSpaceLayer layers.
Constructs a QValueSpaceSubscriber with the specified parent that refers to path.
The constructed Value Space subscriber will access all available QAbstractValueSpaceLayer layers.
Constructs a QValueSpaceSubscriber with the specified parent that refers to path. The filter parameter is used to limit which layers this QValueSpaceSubscriber will access.
If a layer matching filter is not found, the constructed QValueSpaceSubscriber will be unconnected.
See also isConnected().
Constructs a QValueSpaceSubscriber with the specified parent that refers to path. This QValueSpaceSubscriber will only use the layer identified by uuid.
Use of this constructor is not platform agnostic. If possible use one of the constructors that take a QAbstractValueSpaceLayer::LayerOptions parameter instead.
If a layer with a matching uuid is not found, the constructed QValueSpaceSubscriber will be unconnected.
See also QAbstractValueSpaceLayer::id(), QValueSpace, and isConnected().
Destroys the QValueSpaceSubscriber.
Changes the path to the absolute path if path starts with a '/'; otherwise changes to the sub path of the current path.
Sets the path to parent of the current path.
Emitted whenever any value under the current path changes.
Note: that if a value changes multiple times in quick succession, only the most recent value may be accessible via the value() function.
Returns true if this QValueSpaceSubscriber is connected to at least one available layer; otherwise returns false. An unconnected QValueSpaceSubscriber is constructed if the filtering parameters passed to the constructor eliminate all available layers.
Returns a list of sub-paths under the current path. For example, given a Value Space tree containing:
/Settings/Nokia/Device /Settings/Nokia/Other /Settings/Qt /Device/Buttons
QValueSpaceSubscriber("/Settings").subPaths() will return a list containing { Nokia, Qt } in no particular order.
Returns the value of the subPath under this subscriber path, or the value of this subscriber path if subPath is empty. If the value does not exists def is returned.
The following code shows how the subscriber path and subPath relate.
QValueSpaceSubscriber base("/Settings");
QValueSpaceSubscriber equiv("/Settings/Nokia/General/Mappings");
// Is true
equiv.value() == base.value("Nokia/General/Mappings");