QIosFileDialog - properly handle QUrl for assets-library
For QT_PLATFORM_UIKIT 'PicturesLocation' manually appended by "assets-library://". When converted to QUrl, such a path becomes a valid url, having empty path and scheme "assets-library". Later in QIOSFileDialog we convert this path (options()->initialDirectory()) calling QUrl::toLocalPath, which gives us an empty string and thus we erroneusly select document picker dialog, not an image picker. So let's also check a scheme, not path only. Pick-to: 6.5 6.4 6.2 Fixes: QTBUG-107844 Change-Id: If4dd453549b37933cba07b5d7af6e45f2504dd29 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>bb10
parent
3dc6fdc6d8
commit
402a526b2a
|
|
@ -36,11 +36,15 @@ bool QIOSFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality window
|
|||
Q_UNUSED(windowFlags);
|
||||
Q_UNUSED(windowModality);
|
||||
|
||||
bool acceptOpen = options()->acceptMode() == QFileDialogOptions::AcceptOpen;
|
||||
QString directory = options()->initialDirectory().toLocalFile();
|
||||
const bool acceptOpen = options()->acceptMode() == QFileDialogOptions::AcceptOpen;
|
||||
const auto initialDir = options()->initialDirectory();
|
||||
const QString directory = initialDir.toLocalFile();
|
||||
// We manually add assets-library:// to the list of paths,
|
||||
// when converted to QUrl, it becames a scheme.
|
||||
const QString scheme = initialDir.scheme();
|
||||
|
||||
if (acceptOpen) {
|
||||
if (directory.startsWith("assets-library:"_L1))
|
||||
if (directory.startsWith("assets-library:"_L1) || scheme == "assets-library"_L1)
|
||||
return showImagePickerDialog(parent);
|
||||
else
|
||||
return showNativeDocumentPickerDialog(parent);
|
||||
|
|
|
|||
Loading…
Reference in New Issue