[PyQt] how to prevent QFileDialog.getSaveFileName from overwriting

Darren Dale darren.dale at cornell.edu
Fri Feb 15 14:59:13 GMT 2008


I am using QFileDialog.getSaveFileName:

from PyQt4 import QtGui
a = QtGui.QApplication([])
f = QtGui.QFileDialog.getSaveFileName(None, 'Open File', '.')
print f

If I select an existing file and select save, another dialog automatically 
pops up asking if I want to replace it. If I select no, getSaveFileName still 
returns the filename. Is this behavior correct, and if so, how do I avoid 
overwriting the file?

In case it is important, I'm using PyQt-4.3.3, Qt-4.3.3 and sip-4.7.3.

Thanks,
Darren


More information about the PyQt mailing list