forked from qt-creator/qt-creator
QmlDesigner: Auto close 3D import dialog on success
Fixes: QDS-6573 Change-Id: I790a88a683e1cf4ca846148a4cde01b07b2a1844 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -724,11 +724,13 @@ void ItemLibraryAssetImportDialog::setCloseButtonState(bool importing)
|
|||||||
|
|
||||||
void ItemLibraryAssetImportDialog::addError(const QString &error, const QString &srcPath)
|
void ItemLibraryAssetImportDialog::addError(const QString &error, const QString &srcPath)
|
||||||
{
|
{
|
||||||
|
m_closeOnFinish = false;
|
||||||
addFormattedMessage(m_outputFormatter, error, srcPath, Utils::StdErrFormat);
|
addFormattedMessage(m_outputFormatter, error, srcPath, Utils::StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemLibraryAssetImportDialog::addWarning(const QString &warning, const QString &srcPath)
|
void ItemLibraryAssetImportDialog::addWarning(const QString &warning, const QString &srcPath)
|
||||||
{
|
{
|
||||||
|
m_closeOnFinish = false;
|
||||||
addFormattedMessage(m_outputFormatter, warning, srcPath, Utils::StdOutFormat);
|
addFormattedMessage(m_outputFormatter, warning, srcPath, Utils::StdOutFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -777,6 +779,10 @@ void ItemLibraryAssetImportDialog::onImportFinished()
|
|||||||
QString doneStr = tr("Import done.");
|
QString doneStr = tr("Import done.");
|
||||||
addInfo(doneStr);
|
addInfo(doneStr);
|
||||||
setImportProgress(100, doneStr);
|
setImportProgress(100, doneStr);
|
||||||
|
if (m_closeOnFinish) {
|
||||||
|
// Add small delay to allow user to visually confirm import finishing
|
||||||
|
QTimer::singleShot(1000, this, &ItemLibraryAssetImportDialog::onClose);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -785,7 +791,7 @@ void ItemLibraryAssetImportDialog::onClose()
|
|||||||
if (m_importer.isImporting()) {
|
if (m_importer.isImporting()) {
|
||||||
addInfo(tr("Canceling import."));
|
addInfo(tr("Canceling import."));
|
||||||
m_importer.cancelImport();
|
m_importer.cancelImport();
|
||||||
} else {
|
} else if (isVisible()) {
|
||||||
if (ui->progressBar->value() == 100) // import done successfully
|
if (ui->progressBar->value() == 100) // import done successfully
|
||||||
accept();
|
accept();
|
||||||
else
|
else
|
||||||
|
@@ -91,5 +91,6 @@ private:
|
|||||||
int m_optionsHeight = 0;
|
int m_optionsHeight = 0;
|
||||||
int m_optionsRows = 0;
|
int m_optionsRows = 0;
|
||||||
QSet<QString> m_preselectedFilesForOverwrite;
|
QSet<QString> m_preselectedFilesForOverwrite;
|
||||||
|
bool m_closeOnFinish = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user