QFileDialog/win: pass only filename to IFileDialog::SetFileName()
When calling QFileDialog::selectFile(), the file is passed as QUrl to the underlying functions. Then this url was converted back to a local file and the full path (with wrong path separators on windows) was shown in the filename edit box in the native dialog. There was already a comment to use QUrl::fileName() but it did not exist when the code was written and later it was forgotten. Fixes: QTBUG-47159 Change-Id: I478dfd0e4943277c0ac78ebf4e138257e7ea8662 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit 19c701d370512e81d1b934f899b03ae0c2e6953f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 4938b234ad251c5b2480bb9e28b3482fb4425345)
This commit is contained in:
parent
4883d2f591
commit
93ed05edfa
@ -1585,7 +1585,7 @@ void QWindowsFileDialogHelper::selectFile(const QUrl &fileName)
|
||||
qCDebug(lcQpaDialogs) << __FUNCTION__ << fileName.toString();
|
||||
|
||||
if (hasNativeDialog()) // Might be invoked from the QFileDialog constructor.
|
||||
nativeFileDialog()->selectFile(fileName.toLocalFile()); // ## should use QUrl::fileName() once it exists
|
||||
nativeFileDialog()->selectFile(fileName.fileName());
|
||||
}
|
||||
|
||||
QList<QUrl> QWindowsFileDialogHelper::selectedFiles() const
|
||||
|
Loading…
x
Reference in New Issue
Block a user