- Major styling improvements

- Some renaming
This commit is contained in:
Dorian Zedler 2020-10-17 21:51:33 +02:00
parent 1ec609e7c2
commit 534277a198
Signed by: dorian
GPG Key ID: D3B255CB8BC7CD37
4 changed files with 10 additions and 4 deletions

View File

@ -19,11 +19,11 @@ CONFIG += c++11
INCLUDEPATH += $$PWD/ INCLUDEPATH += $$PWD/
SOURCES += \ SOURCES += \
$$PWD/qbluetoothleuart.cpp \ $$PWD/qbluetoothleuartclient.cpp \
$$PWD/qbluetoothleuartdevice.cpp \ $$PWD/qbluetoothleuartdevice.cpp \
$$PWD/qbluetoothleuartdevicemodel.cpp $$PWD/qbluetoothleuartdevicemodel.cpp
HEADERS += \ HEADERS += \
$$PWD/qbluetoothleuart.h \ $$PWD/qbluetoothleuartclient.h \
$$PWD/qbluetoothleuartdevice.h \ $$PWD/qbluetoothleuartdevice.h \
$$PWD/qbluetoothleuartdevicemodel.h $$PWD/qbluetoothleuartdevicemodel.h

View File

@ -20,7 +20,7 @@ class QBluetoothLeUartDevice: public QObject
public: public:
QBluetoothLeUartDevice(QBluetoothDeviceInfo device, QObject *parent = nullptr); QBluetoothLeUartDevice(QBluetoothDeviceInfo device, QObject *parent = nullptr);
friend class QBluetoothLeUart; friend class QBluetoothLeUartClient;
/*! /*!
* \brief Function to get the name of the device * \brief Function to get the name of the device

View File

@ -3,6 +3,8 @@
QBluetoothLeUartDeviceModel::QBluetoothLeUartDeviceModel(QList<QBluetoothLeUartDevice*> availableDevices, QObject* parent) : QAbstractListModel(parent) QBluetoothLeUartDeviceModel::QBluetoothLeUartDeviceModel(QList<QBluetoothLeUartDevice*> availableDevices, QObject* parent) : QAbstractListModel(parent)
{ {
this->availableDevices = availableDevices; this->availableDevices = availableDevices;
connect(this, &QBluetoothLeUartDeviceModel::rowsInserted, this, &QBluetoothLeUartDeviceModel::rowCountChanged);
connect(this, &QBluetoothLeUartDeviceModel::rowsRemoved, this, &QBluetoothLeUartDeviceModel::rowCountChanged);
} }
int QBluetoothLeUartDeviceModel::rowCount(const QModelIndex &) const int QBluetoothLeUartDeviceModel::rowCount(const QModelIndex &) const

View File

@ -35,8 +35,9 @@
class QBluetoothLeUartDeviceModel : public QAbstractListModel class QBluetoothLeUartDeviceModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged)
public: public:
friend class QBluetoothLeUart; friend class QBluetoothLeUartClient;
enum QBluetoothLeUartDeviceModelRole { enum QBluetoothLeUartDeviceModelRole {
NameRole = Qt::DisplayRole, NameRole = Qt::DisplayRole,
@ -60,6 +61,9 @@ protected:
private: private:
QList<QBluetoothLeUartDevice*> availableDevices; QList<QBluetoothLeUartDevice*> availableDevices;
signals:
void rowCountChanged();
}; };
#endif // QBLUETOOTHLEUARTDEVICEMODEL_H #endif // QBLUETOOTHLEUARTDEVICEMODEL_H