Monitor and query plugged mouse devices. More...
#include <mousedevicesmonitor.h>
Public Slots | |
| Q_SCRIPTABLE QStringList | pluggedMouseDevices () const |
| List all currently plugged mouse devices. | |
| Q_SCRIPTABLE QString | productName (const QString &id) const |
| Query the product name of a device. | |
| Q_SCRIPTABLE bool | isTouchpad (const QString &id) const |
| Is the given device a touchpad? | |
Signals | |
| Q_SCRIPTABLE void | mousePlugged (const QString &id) |
| A mouse device was plugged. | |
| Q_SCRIPTABLE void | mouseUnplugged (const QString &id) |
| A mouse device was unplugged. | |
Public Member Functions | |
| MouseDevicesMonitor (QObject *parent=0) | |
| Create a new object. | |
| virtual | ~MouseDevicesMonitor () |
| Destroy this object. | |
Monitor and query plugged mouse devices.
This class constantly monitors mouse devices. It emits signals, if mouse devices are plugged or unplugged, and provides rudimentary information about plugged mouse devices.
To be informed about plugged and unplugged mouses, just connect to the corresponding signals:
MouseDevicesMonitor *monitor = new MouseDevicesMonitor(this); this->connect(monitor, SIGNAL(mousePlugged(const QString&)), SLOT(doSomethingWithPluggedMouse(const QString&))); this->connect(monitor, SIGNAL(mouseUnplugged(const QString&)), SLOT(doSomethingWithUnluggedMouse(const QString&)));
You can also use this class to enumerate plugged devices:
foreach (QString mouse, monitor->pluggedMouseDevices()) {
kDebug() << monitor->productName(mouse);
}
All members marked as Q_SCRIPTABLE are exported on D-Bus on the interface org.kde.MouseDevicesManager.
| MouseDevicesMonitor::MouseDevicesMonitor | ( | QObject * | parent = 0 |
) |
Create a new object.
| parent | same as for QObject(QObject*) |
| bool MouseDevicesMonitor::isTouchpad | ( | const QString & | id | ) | const [slot] |
Is the given device a touchpad?
Only use this method with plugged devices. This class cannot obtain information about devices, which are not currently plugged.
| id | the device id |
true, if the given device is a touchpad, false otherwise | Q_SCRIPTABLE void synaptiks::MouseDevicesMonitor::mousePlugged | ( | const QString & | id | ) | [signal] |
A mouse device was plugged.
| id | the id of this device |
| Q_SCRIPTABLE void synaptiks::MouseDevicesMonitor::mouseUnplugged | ( | const QString & | id | ) | [signal] |
A mouse device was unplugged.
Do not pass the given id to methods of this class. This slot is invoked after the mouse has been unplugged, therefore this class cannot any longer obtain information about the device.
| id | the id of this device |
| QStringList MouseDevicesMonitor::pluggedMouseDevices | ( | ) | const [slot] |
List all currently plugged mouse devices.
| QString MouseDevicesMonitor::productName | ( | const QString & | id | ) | const [slot] |
Query the product name of a device.
Only use this method with plugged devices. This class cannot obtain information about devices, which are not currently plugged.
| id | the device id |
1.6.3