ElementsCollectionModel::loadCollections() runs setUpData() for every
item on worker threads (QtConcurrent::map), and setUpData() calls
setText(), setFlags(), setData() and setToolTip() on items that are
already in the model. Each of these changes the model and emits its
dataChanged() signal from a worker thread, which QAbstractItemModel
does not allow. Loading the shipped collection (8838 elements) emitted
dataChanged() 38958 times, all from worker threads.
The expensive part (reading every element file) stays on the worker
threads. Only the result is moved: ElementCollectionItem::setData()
keeps a value set from a worker thread on the item, data() returns it
to the same worker so setUpData() still reads back what it has set,
and the model applies the kept values on the GUI thread when the map
is finished, before emitting loadingFinished(). setUpData() called on
the GUI thread (macros collection, a single added or changed element)
is unchanged.
With this change the same load emits dataChanged() 38958 times, all on
the GUI thread.
Revives the still-needed part of #516, closed only to clear a review
backlog. Its other two changes are left out: the wait in
loadMacrosCollection() guarded a model shared with a running map,
which no longer happens (the macros always get a model of their own),
and qetinformation.h's static QString constants are a size clean-up,
not a bug.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Now Qet only use the new embbeded collection (XmlElementCollection).
No need to reload the old element panel for add a new element created by the new element panel
Elements are always imported to the embbeded collection of a project
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4468 bfdf4180-ca20-0410-9c96-a3a8aa849046
new element panel update the content of the item who represent the edited element (pixmap and name)
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4399 bfdf4180-ca20-0410-9c96-a3a8aa849046
We must to use elementcollectionhandler instead
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4343 bfdf4180-ca20-0410-9c96-a3a8aa849046
elementsCollectionModel : Up to date the content when a new item is added to the embedded collection of a project.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4312 bfdf4180-ca20-0410-9c96-a3a8aa849046