From 6e60171bf7534582f59eeded7129b42abeefb0d1 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 4 Mar 2019 14:58:27 +0200 Subject: [PATCH] Speed up loading pattern file by delaying garbage collecting. --HG-- branch : develop --- src/app/valentina/mainwindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 17fbe6608..e5469dde1 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -4721,7 +4721,11 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile) { // No errors occurred /* Collect garbage only after successfully parse. This way wrongly accused items have one more time to restore * a reference. */ +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) + QTimer::singleShot(100, Qt::CoarseTimer, this, [this](){doc->GarbageCollector(true);}); +#else doc->GarbageCollector(true); +#endif patternReadOnly = doc->IsReadOnly(); SetEnableWidgets(true);