[PyQt] how to prevent QFileDialog.getSaveFileName from overwriting

Giovanni Bajo rasky at develer.com
Fri Feb 15 18:04:58 GMT 2008


On 2/15/2008 3:59 PM, Darren Dale wrote:
> 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.

I don't see this under Windows, and I don't know how it would be related 
to PyQt at all. That dialog is the OS one under Windows and Mac OSX, so 
if you're using Linux it might be a bug of the Qt implementation used by 
Linux -- which you should report to Trolltech.
-- 
Giovanni Bajo



More information about the PyQt mailing list