mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Replace std::thread with QtConcurrent
This commit is contained in:
parent
72d5d6d286
commit
f02d3ee606
2 changed files with 3 additions and 5 deletions
|
@ -20,6 +20,7 @@ Specifically there is support for:
|
||||||
- Sending & receiving invites.
|
- Sending & receiving invites.
|
||||||
- Sending & receiving files and emoji (inline widgets for images, audio and file messages).
|
- Sending & receiving files and emoji (inline widgets for images, audio and file messages).
|
||||||
- Typing notifications.
|
- Typing notifications.
|
||||||
|
- Username auto-completion.
|
||||||
- Message & mention notifications.
|
- Message & mention notifications.
|
||||||
- Redacting messages.
|
- Redacting messages.
|
||||||
- Read receipts.
|
- Read receipts.
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
#include <QAbstractTextDocumentLayout>
|
#include <QAbstractTextDocumentLayout>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
|
@ -29,6 +27,7 @@
|
||||||
#include <QMimeType>
|
#include <QMimeType>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
|
#include <QtConcurrent>
|
||||||
|
|
||||||
#include <variant.hpp>
|
#include <variant.hpp>
|
||||||
|
|
||||||
|
@ -437,7 +436,7 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
||||||
if (q.isEmpty() || currState_.isNull())
|
if (q.isEmpty() || currState_.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::thread worker([this, q = q.toLower().toStdString()]() {
|
QtConcurrent::run([this, q = q.toLower().toStdString()]() {
|
||||||
std::multimap<int, std::pair<std::string, std::string>> items;
|
std::multimap<int, std::pair<std::string, std::string>> items;
|
||||||
|
|
||||||
auto get_name = [](auto membership) {
|
auto get_name = [](auto membership) {
|
||||||
|
@ -476,8 +475,6 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
||||||
|
|
||||||
emit input_->resultsRetrieved(results);
|
emit input_->resultsRetrieved(results);
|
||||||
});
|
});
|
||||||
|
|
||||||
worker.detach();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
sendMessageBtn_ = new FlatButton(this);
|
sendMessageBtn_ = new FlatButton(this);
|
||||||
|
|
Loading…
Reference in a new issue