QFileDialog: use QUrl::toString(QUrl::PreferLocalFile)
It'll handle both cases. Change-Id: I6e2e037f19eff74a1e99b2a92dc2c9daf11fcd94 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
7396f36e42
commit
f2d7e31bae
@ -1271,12 +1271,9 @@ QStringList QFileDialog::selectedFiles() const
|
||||
QStringList files;
|
||||
const QList<QUrl> userSelectedFiles = d->userSelectedFiles();
|
||||
files.reserve(userSelectedFiles.size());
|
||||
for (const QUrl &file : userSelectedFiles) {
|
||||
if (file.isLocalFile() || file.isEmpty())
|
||||
files.append(file.toLocalFile());
|
||||
else
|
||||
files.append(file.toString());
|
||||
}
|
||||
for (const QUrl &file : userSelectedFiles)
|
||||
files.append(file.toString(QUrl::PreferLocalFile));
|
||||
|
||||
if (files.isEmpty() && d->usingWidgets()) {
|
||||
const FileMode fm = fileMode();
|
||||
if (fm != ExistingFile && fm != ExistingFiles)
|
||||
@ -2193,12 +2190,8 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
|
||||
filter, selectedFilter, options, schemes);
|
||||
QStringList fileNames;
|
||||
fileNames.reserve(selectedUrls.size());
|
||||
for (const QUrl &url : selectedUrls) {
|
||||
if (url.isLocalFile() || url.isEmpty())
|
||||
fileNames << url.toLocalFile();
|
||||
else
|
||||
fileNames << url.toString();
|
||||
}
|
||||
for (const QUrl &url : selectedUrls)
|
||||
fileNames.append(url.toString(QUrl::PreferLocalFile));
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user