mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-12 13:56:17 +00:00
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>
This commit is contained in:
parent
2183e41bb0
commit
466a0bf758
2 changed files with 14 additions and 0 deletions
|
@ -15,6 +15,8 @@
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QtConcurrent>
|
||||||
|
#include <QFuture>
|
||||||
|
|
||||||
#include <QBluetoothLocalDevice>
|
#include <QBluetoothLocalDevice>
|
||||||
|
|
||||||
|
@ -1844,6 +1846,17 @@ void QMLManager::showDownloadPage(QString deviceString)
|
||||||
emit pluggedInDeviceNameChanged();
|
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)
|
#if defined(Q_OS_ANDROID)
|
||||||
// implemented in core/android.cpp
|
// implemented in core/android.cpp
|
||||||
void checkPendingIntents();
|
void checkPendingIntents();
|
||||||
|
|
|
@ -88,6 +88,7 @@ public:
|
||||||
Q_INVOKABLE int getDetectedProductIndex(const QString ¤tVendorText);
|
Q_INVOKABLE int getDetectedProductIndex(const QString ¤tVendorText);
|
||||||
Q_INVOKABLE int getConnectionIndex(const QString &deviceSubstr);
|
Q_INVOKABLE int getConnectionIndex(const QString &deviceSubstr);
|
||||||
Q_INVOKABLE void setGitLocalOnly(const bool &value);
|
Q_INVOKABLE void setGitLocalOnly(const bool &value);
|
||||||
|
Q_INVOKABLE void setFilter(const QString filterText);
|
||||||
|
|
||||||
static QMLManager *instance();
|
static QMLManager *instance();
|
||||||
Q_INVOKABLE void registerError(QString error);
|
Q_INVOKABLE void registerError(QString error);
|
||||||
|
|
Loading…
Add table
Reference in a new issue