Solid::Ifaces::GenericInterface Class

class Solid::Ifaces::GenericInterface
Header: #include <GenericInterface>
CMake: find_package(KF6 REQUIRED COMPONENTS Solid)
target_link_libraries(mytarget PRIVATE KF6::Solid)

Public Functions

virtual ~GenericInterface()
virtual QMap<QString, QVariant> allProperties() const = 0
virtual QVariant property(const QString &key) const = 0
virtual bool propertyExists(const QString &key) const = 0

Protected Functions

virtual void conditionRaised(const QString &condition, const QString &reason) = 0
virtual void propertyChanged(const QMap<QString, int> &changes) = 0

Detailed Description

Generic interface to deal with a device. It exposes a set of properties and is organized a a key/value set.

Warning: Using this class could expose some backend specific details and lead to non portable code. Use it at your own risk, or during transitional phases when the provided device interfaces don't provide the necessary methods.

Member Function Documentation

[virtual noexcept] GenericInterface::~GenericInterface()

Destroys a GenericInterface object.

[pure virtual] QMap<QString, QVariant> GenericInterface::allProperties() const

Retrieves all the properties of this device.

@returns all properties in a map

[pure virtual protected] void GenericInterface::conditionRaised(const QString &condition, const QString &reason)

This signal is emitted when an event occurred in the device. For example when a button is pressed.

@param condition the condition name @param reason a message explaining why the condition has been raised

[pure virtual] QVariant GenericInterface::property(const QString &key) const

Retrieves the value of a property.

@param key the property name @returns the property value or QVariant() if the property doesn't exist

[pure virtual protected] void GenericInterface::propertyChanged(const QMap<QString, int> &changes)

This signal is emitted when a property is changed in the device.

@param changes the map describing the property changes that occurred in the device, keys are property name and values describe the kind of change done on the device property (added/removed/modified), it's one of the type Solid::Device::PropertyChange

[pure virtual] bool GenericInterface::propertyExists(const QString &key) const

Tests if a property exist.

@param key the property name @returns true if the property exists in this device, false otherwise