Pages
API Documentation
On this page

Solid::DeviceNotifier Class

This class allow to query the underlying system for information about the hardware available. More...

  • Header: #include <Solid/DeviceNotifier>
  • CMake: find_package(KF6 REQUIRED COMPONENTS Solid)
    target_link_libraries(mytarget PRIVATE KF6::Solid)
  • Inherits: QObject

List of all members, including inherited members

Signals

Static Public Members

Detailed Description

Applications should use this to be notified about hardware changes.

Note that it's implemented as a singleton and encapsulates the backend logic.

Member Function Documentation

[signal] void DeviceNotifier::deviceAdded(const QString &udi)

This signal is emitted when a new device with the given udi appears in the underlying system.

[signal] void DeviceNotifier::deviceRemoved(const QString &udi)

This signal is emitted when a device with the given udi disappears from the underlying system.

[static] Solid::DeviceNotifier *DeviceNotifier::instance()

Returns a pointer to the global DeviceNotifier instance to allow for its use with QObject::connect();

auto notifier = Solid::DeviceNotifier::instance();

auto refresh = [this] (const QString &udi) {
    Solid::Device device(udi);
    if (device.is<Solid::StorageDrive>()) {
        qInfo() << "A new storage drive was added!";
    }
};
QObject::connect(notifier, &Solid::DeviceNotifier::deviceAdded, refresh);
We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.