aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickdialogs2/quickdialogs2quickimpl/qquickfiledialogimpl.cpp
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2022-04-12 10:36:08 +0800
committerMitch Curtis <mitch.curtis@qt.io>2022-07-05 15:48:29 +0800
commit24c73420235bd9dd3f3f69819a522ee5b616ef96 (patch)
treee0081e2a695748b62f866a7beb12c20525d50bd5 /src/quickdialogs2/quickdialogs2quickimpl/qquickfiledialogimpl.cpp
parente292a0e287286c412acd5fa6a8a677ef420978a9 (diff)
Fix flaky tst_QQuickFileDialogImpl::goUp test
Don't listen to fileDialogListView currentIndexChanged signal while setting its currentIndex, because the file associated with the delegate is not correct at that stage. Change-Id: Iffc9315c03b6670bc3a7609f3613a4570e4f9632 Fixes: QTBUG-101488 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit dc86f974f0ce5ac57ddeceee3b020661b932f6b1) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/quickdialogs2/quickdialogs2quickimpl/qquickfiledialogimpl.cpp')
-rw-r--r--src/quickdialogs2/quickdialogs2quickimpl/qquickfiledialogimpl.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/quickdialogs2/quickdialogs2quickimpl/qquickfiledialogimpl.cpp b/src/quickdialogs2/quickdialogs2quickimpl/qquickfiledialogimpl.cpp
index 02356b3bc2..4d37fee39a 100644
--- a/src/quickdialogs2/quickdialogs2quickimpl/qquickfiledialogimpl.cpp
+++ b/src/quickdialogs2/quickdialogs2quickimpl/qquickfiledialogimpl.cpp
@@ -148,7 +148,14 @@ void QQuickFileDialogImplPrivate::updateCurrentFile(const QString &oldFolderPath
if (!newCurrentFilePath.isEmpty()) {
q->setCurrentFile(QUrl::fromLocalFile(newCurrentFilePath));
- attached->fileDialogListView()->setCurrentIndex(newCurrentFileIndex);
+ {
+ // Set the appropriate currentIndex for the selected file. We block signals from ListView
+ // because we don't want fileDialogListViewCurrentIndexChanged to be called, as the file
+ // it gets from the delegate will not be up-to-date (but most importantly because we already
+ // just set the selected file).
+ QSignalBlocker blocker(attached->fileDialogListView());
+ attached->fileDialogListView()->setCurrentIndex(newCurrentFileIndex);
+ }
if (QQuickItem *currentItem = attached->fileDialogListView()->currentItem())
currentItem->forceActiveFocus();
}