diff options
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); |