[PyKDE] Re: Savefile dialog (QFileDialog.getSaveFileName).

kakada hokkakada at khmeros.info
Wed Aug 23 11:04:32 BST 2006

បានសរសេរ Lukáš Lalinský:
> kakada wrote:
>> your solution is detecting the filename if it exist or not,  but not the
>> button (Save or Cancel).
>> Because if your filename isEmpty, either do you click OK nor Cancel;as
>> the result, you always get "No file selected"
> I believe the function doesn't let you to click OK with an empty file name.
> http://doc.trolltech.com/4.1/qfiledialog.html#getOpenFileName
> "If the user presses Cancel, it returns a null string."
It doesn't matter with getOpenFileName. The problem is with getSaveFileName

 "return a file name selected by the user. The file does not have to exist." 

 if not self.fileName.isEmpty():
        QtGui.QMessageBox.information(self,self.tr("Information") ,self.tr("Please specify the filename to save to"))

Message box is always displayed if the filename is empty.


More information about the PyQt mailing list