Fix quick file dialog on android

Patch 13399bd54d084ed837ec061ca9315dbd173f3b48 removed the accept
handler on QQuickFileDialog, which was triggering setSelectFiles on
android.
So changed qandroidplatformfiledialoghelper to also emit currentChanged
which will trigger the QQuickFileDialog to setSelectFiles since there
is a connect to that signal. Emitting currentChanged signal is also the
signal used in others QPlatformFileDialogHelpers.

Fixes: QTBUG-101013
Pick-to: 6.3
Change-Id: I22f2d583f4be26a83e1c19190458fb5011e40095
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
Samuel Mira 2022-03-08 16:32:51 +02:00
parent 31d401dec6
commit 2edc0025fa

View File

@ -80,6 +80,7 @@ bool QAndroidPlatformFileDialogHelper::handleActivityResult(jint requestCode, ji
takePersistableUriPermission(uri); takePersistableUriPermission(uri);
m_selectedFile.append(QUrl(uri.toString())); m_selectedFile.append(QUrl(uri.toString()));
Q_EMIT fileSelected(m_selectedFile.first()); Q_EMIT fileSelected(m_selectedFile.first());
Q_EMIT currentChanged(m_selectedFile.first());
Q_EMIT accept(); Q_EMIT accept();
return true; return true;
@ -98,6 +99,7 @@ bool QAndroidPlatformFileDialogHelper::handleActivityResult(jint requestCode, ji
m_selectedFile.append(itemUri.toString()); m_selectedFile.append(itemUri.toString());
} }
Q_EMIT filesSelected(m_selectedFile); Q_EMIT filesSelected(m_selectedFile);
Q_EMIT currentChanged(m_selectedFile.first());
Q_EMIT accept(); Q_EMIT accept();
} }