mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-01 17:14:13 +02:00
Re-enable multi-threading to load collection
The name of the elements and folders of the collection are not displayed until we hover the item with the mouse. This due that QtConcurent::run was disabled at loading of collection in the goal of use QtConcurrent::run with Qt6. Run is made to run a function once. Map is made to run a fonction for each item of a sequence (what we need in this case). Remove code of run and re-enable code for map.
This commit is contained in:
@@ -25,12 +25,8 @@
|
|||||||
#include "xmlelementcollection.h"
|
#include "xmlelementcollection.h"
|
||||||
#include "xmlprojectelementcollectionitem.h"
|
#include "xmlprojectelementcollectionitem.h"
|
||||||
|
|
||||||
#include <QFutureWatcher>
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
|
||||||
#include <QtConcurrentMap>
|
#include <QtConcurrentMap>
|
||||||
#else
|
|
||||||
#include <QtConcurrentRun>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief ElementsCollectionModel::ElementsCollectionModel
|
@brief ElementsCollectionModel::ElementsCollectionModel
|
||||||
@@ -297,11 +293,8 @@ void ElementsCollectionModel::loadCollections(bool common_collection,
|
|||||||
this, &ElementsCollectionModel::loadingFinished);
|
this, &ElementsCollectionModel::loadingFinished);
|
||||||
connect(watcher, &QFutureWatcher<void>::finished, watcher, &QFutureWatcher<void>::deleteLater);
|
connect(watcher, &QFutureWatcher<void>::finished, watcher, &QFutureWatcher<void>::deleteLater);
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
m_future = QtConcurrent::map(m_items_list_to_setUp, setUpData);
|
m_future = QtConcurrent::map(m_items_list_to_setUp, setUpData);
|
||||||
#else
|
|
||||||
qDebug() << "Help code for QT 6 or later";
|
|
||||||
#endif
|
|
||||||
watcher->setFuture(m_future);
|
watcher->setFuture(m_future);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user