From 0b053eaa88ffdcc0b32e533904e5e266b8e62fb3 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 11 Oct 2020 21:01:01 +0200 Subject: [PATCH] some fixes --- qbluetoothleuart.h | 8 +++++++- qbluetoothleuartdevicemodel.cpp | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/qbluetoothleuart.h b/qbluetoothleuart.h index 09a6784..82ccfb0 100644 --- a/qbluetoothleuart.h +++ b/qbluetoothleuart.h @@ -19,7 +19,7 @@ * \section intro_sec Introduction * * This library can be used to talk to BLE devices via UART in Qt. - * It was designed to make taklking to device like the ESP32 from Qt easier. + * It was designed to make talking to devices like the ESP32 from Qt easier. * * \section section Installation * \code{.sh} @@ -35,6 +35,12 @@ * # Include library * include($$PWD/QBluetoothLeUart/QBluetoothLeUart.pri) * \endcode + * + * To enable the QML module you need to call + * \code{.cpp} + * QBluetoothLeUart::init(); + * \endcode + * somewhere before app.exec(); in your main.cpp. */ /*! diff --git a/qbluetoothleuartdevicemodel.cpp b/qbluetoothleuartdevicemodel.cpp index e851178..f351143 100644 --- a/qbluetoothleuartdevicemodel.cpp +++ b/qbluetoothleuartdevicemodel.cpp @@ -59,6 +59,11 @@ void QBluetoothLeUartDeviceModel::remove(int row) } void QBluetoothLeUartDeviceModel::clear() { - for(int i = 0; i < this->availableDevices.length(); i++) - this->remove(i); + + this->beginResetModel(); + this->resetInternalData(); + + this->availableDevices.clear(); + + this->endResetModel(); }