Fixed crash for pre-Qt5.6

Qt has garbage documentation. I dug into Qt 5.0 source code to make sure
the crashing call can be safely left out for older versions, and that is
indeed the case. setSupportedSchemes() appears to be introduced together
with the future to select non-local files in the dialog, but we only
cared about local files to begin with.
This commit is contained in:
Jan Wester 2019-08-09 16:43:17 +02:00 committed by Curtis Gedak
parent f6fa3e8375
commit 5da31230c7

View file

@ -399,7 +399,8 @@ def getSaveFileNameWithSuffix(parent, caption, directory, filter, options=None,
if defaultSuffix:
dialog.setDefaultSuffix(defaultSuffix)
dialog.setFileMode(QFileDialog.AnyFile)
dialog.setSupportedSchemes(("file",))
if hasattr(dialog, 'setSupportedSchemes'): # Pre-Qt5.6 lacks this.
dialog.setSupportedSchemes(("file",))
dialog.setAcceptMode(QFileDialog.AcceptSave)
if selectedFilter:
dialog.selectNameFilter(selectedFilter)