diff --git a/QBluetoothLeUart.pri b/QBluetoothLeUart.pri index c40eb9a..c190bbf 100644 --- a/QBluetoothLeUart.pri +++ b/QBluetoothLeUart.pri @@ -19,11 +19,11 @@ CONFIG += c++11 INCLUDEPATH += $$PWD/ SOURCES += \ - $$PWD/qbluetoothleuart.cpp \ + $$PWD/qbluetoothleuartclient.cpp \ $$PWD/qbluetoothleuartdevice.cpp \ $$PWD/qbluetoothleuartdevicemodel.cpp HEADERS += \ - $$PWD/qbluetoothleuart.h \ + $$PWD/qbluetoothleuartclient.h \ $$PWD/qbluetoothleuartdevice.h \ $$PWD/qbluetoothleuartdevicemodel.h diff --git a/qbluetoothleuartdevice.h b/qbluetoothleuartdevice.h index e0415a6..2f0c42b 100644 --- a/qbluetoothleuartdevice.h +++ b/qbluetoothleuartdevice.h @@ -20,7 +20,7 @@ class QBluetoothLeUartDevice: public QObject public: QBluetoothLeUartDevice(QBluetoothDeviceInfo device, QObject *parent = nullptr); - friend class QBluetoothLeUart; + friend class QBluetoothLeUartClient; /*! * \brief Function to get the name of the device diff --git a/qbluetoothleuartdevicemodel.cpp b/qbluetoothleuartdevicemodel.cpp index f351143..012944a 100644 --- a/qbluetoothleuartdevicemodel.cpp +++ b/qbluetoothleuartdevicemodel.cpp @@ -3,6 +3,8 @@ QBluetoothLeUartDeviceModel::QBluetoothLeUartDeviceModel(QList availableDevices, QObject* parent) : QAbstractListModel(parent) { this->availableDevices = availableDevices; + connect(this, &QBluetoothLeUartDeviceModel::rowsInserted, this, &QBluetoothLeUartDeviceModel::rowCountChanged); + connect(this, &QBluetoothLeUartDeviceModel::rowsRemoved, this, &QBluetoothLeUartDeviceModel::rowCountChanged); } int QBluetoothLeUartDeviceModel::rowCount(const QModelIndex &) const diff --git a/qbluetoothleuartdevicemodel.h b/qbluetoothleuartdevicemodel.h index 5c07cc8..0bccb0b 100644 --- a/qbluetoothleuartdevicemodel.h +++ b/qbluetoothleuartdevicemodel.h @@ -35,8 +35,9 @@ class QBluetoothLeUartDeviceModel : public QAbstractListModel { Q_OBJECT + Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged) public: - friend class QBluetoothLeUart; + friend class QBluetoothLeUartClient; enum QBluetoothLeUartDeviceModelRole { NameRole = Qt::DisplayRole, @@ -60,6 +61,9 @@ protected: private: QList availableDevices; +signals: + void rowCountChanged(); + }; #endif // QBLUETOOTHLEUARTDEVICEMODEL_H