WinRT: Prepend '.' to default file suffix.
IFileSavePicker::put_DefaultFileExtension() fails when the '.' is missing, causing the QtWidgets-based dialog to show up (Windows 10). Change-Id: Ifcb870431b792ffa8e4a608dec999225e8383fa9 Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
This commit is contained in:
parent
df053dc642
commit
60536d7421
@ -444,12 +444,14 @@ bool QWinRTFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModalit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString suffix = dialogOptions->defaultSuffix();
|
QString suffix = dialogOptions->defaultSuffix();
|
||||||
if (!suffix.isEmpty()) {
|
if (!suffix.isEmpty()) {
|
||||||
|
if (!suffix.startsWith(QLatin1Char('.')))
|
||||||
|
suffix.prepend(QLatin1Char('.'));
|
||||||
HStringReference nativeSuffix(reinterpret_cast<const wchar_t *>(suffix.utf16()),
|
HStringReference nativeSuffix(reinterpret_cast<const wchar_t *>(suffix.utf16()),
|
||||||
suffix.length());
|
suffix.length());
|
||||||
hr = picker->put_DefaultFileExtension(nativeSuffix.Get());
|
hr = picker->put_DefaultFileExtension(nativeSuffix.Get());
|
||||||
RETURN_FALSE_IF_FAILED("Failed to set default file extension");
|
RETURN_FALSE_IF_FAILED_WITH_ARGS("Failed to set default file extension \"%s\"", qPrintable(suffix));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString suggestedName = QFileInfo(d->saveFileName.toLocalFile()).fileName();
|
const QString suggestedName = QFileInfo(d->saveFileName.toLocalFile()).fileName();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user