42#ifndef QDECLARATIVEINPUTDEVICEMODEL_H
43#define QDECLARATIVEINPUTDEVICEMODEL_H
46#include <QAbstractListModel>
47#include "qinputinfo.h"
49class QDeclarativeInputDeviceModel :
public QAbstractListModel
52 Q_DISABLE_COPY(QDeclarativeInputDeviceModel)
53 Q_PROPERTY(QInputDevice::InputType deviceFilter READ deviceFilter WRITE setDeviceFilter NOTIFY deviceFilterChanged)
55 Q_PROPERTY(
int count READ rowCount NOTIFY countChanged)
59 ServiceRole = Qt::UserRole + 1,
69 explicit QDeclarativeInputDeviceModel(QObject *parent = 0);
70 virtual ~QDeclarativeInputDeviceModel();
72 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
73 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
75 void setDeviceFilter(QInputDevice::InputType filter);
76 QInputDevice::InputType deviceFilter();
78 Q_INVOKABLE
int indexOf(
const QString &devicePath)
const;
80 Q_INVOKABLE QInputDevice *get(
int index)
const;
81 QHash<int, QByteArray> roleNames()
const override;
84 void deviceAdded(
const QString &devicePath);
85 void deviceRemoved(
const QString &devicePath);
86 void deviceFilterChanged(
const QInputDevice::InputType filter);
90 void updateDeviceList();
92 QInputDeviceManager *deviceInfo;
93 QVector<QInputDevice *> inputDevices;
94 QInputDevice::InputType currentFilter;
97 void addedDevice(
const QString &);
98 void removedDevice(
const QString &path);