diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2018-10-20 11:59:35 -0400 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-23 22:45:30 +0100 |
commit | 466a0bf75838e67e96b61f296de06205f2177030 (patch) | |
tree | 07e340f3e7fc58a2b56cd07a02b981a45c9509c8 /mobile-widgets | |
parent | 2183e41bb040ab871f0c0b5cb079174b389b171c (diff) | |
download | subsurface-466a0bf75838e67e96b61f296de06205f2177030.tar.gz |
Mobile/filtering: update filter in separate thread
We can't use that while the model is shown, which is why this isn't hooked up.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 13 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index c5603d434..009b1b4db 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -15,6 +15,8 @@ #include <QDateTime> #include <QClipboard> #include <QFile> +#include <QtConcurrent> +#include <QFuture> #include <QBluetoothLocalDevice> @@ -1844,6 +1846,17 @@ void QMLManager::showDownloadPage(QString deviceString) emit pluggedInDeviceNameChanged(); } +void QMLManager::setFilter(const QString filterText) +{ + // show that we are doing something, then do something in another thread in order not to block the UI + QMetaObject::invokeMethod(qmlWindow, "showBusy"); + QtConcurrent::run(QThreadPool::globalInstance(), + [=]{ + dlSortModel->setFilter(filterText); + QMetaObject::invokeMethod(qmlWindow, "hideBusy"); + }); +} + #if defined(Q_OS_ANDROID) // implemented in core/android.cpp void checkPendingIntents(); diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index a8f67389c..98282425d 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -88,6 +88,7 @@ public: Q_INVOKABLE int getDetectedProductIndex(const QString ¤tVendorText); Q_INVOKABLE int getConnectionIndex(const QString &deviceSubstr); Q_INVOKABLE void setGitLocalOnly(const bool &value); + Q_INVOKABLE void setFilter(const QString filterText); static QMLManager *instance(); Q_INVOKABLE void registerError(QString error); |