QmlDesigner: Hold import progress while application inactive

Creator's global filesystem watcher doesn't trigger while the
application is inactive, so changes to file system are not detected it
that is the case. Hold the import process while we are waiting for
filesystem update if the application is inactive.

Fixes: QDS-3809
Change-Id: If55a5ce45ddf06095d7ea51c5dec4f882e83d81f
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2021-02-26 12:34:11 +02:00
parent eaa4592b63
commit f071a3301b

View File

@@ -664,7 +664,12 @@ void ItemLibraryAssetImporter::finalizeQuick3DImport()
timer->callOnTimeout([this, timer, progressTitle, model, doc]() { timer->callOnTimeout([this, timer, progressTitle, model, doc]() {
if (!isCancelled()) { if (!isCancelled()) {
notifyProgress(++counter * 5, progressTitle); notifyProgress(++counter * 5, progressTitle);
if (counter == 10) { if (counter < 10) {
// Do not proceed while application isn't active as the filesystem
// watcher qmljs uses won't trigger unless application is active
if (QApplication::applicationState() != Qt::ApplicationActive)
--counter;
} else if (counter == 10) {
model->rewriterView()->textModifier()->replace(0, 0, {}); model->rewriterView()->textModifier()->replace(0, 0, {});
} else if (counter == 19) { } else if (counter == 19) {
try { try {