[PyQt] Bug in QFileDialog

Baz Walter bazwal at ftml.net
Thu Dec 9 18:35:51 GMT 2010


On 09/12/10 18:01, Vicent Mas wrote:
> On 2010-12-09 Baz Walter<bazwal at ftml.net>  said:
>>> but it means that there is still a bug: in the doItWrong function of my
>>> script the setFileMode call doesn't reset the FileName label to a
>>> default value. So it seems that I'll end writing my first C++ code
>>> (using Antonio's code as a guide) and sending a bug report to Nokia.
>>
>> i can't reproduce this.
>>
>> if i comment out the call to setFileMode in the doItWrong function, the
>> label of the Accept button is set to "accept label"; otherwise it is
>> reset to "Open".
>>
>> so it looks like everything works as per the qt docs.
>>
>> (this is using: python 2.7.1, qt 4.7.1, sip 4.11.2, pyqt 4.8.1)
>
> No, accordingly to the docs the setFileMode sets two constants: FileName and
> Accept. What I say is that the FileName constant is not being reset. At least
> here.

yes, sorry - i missed that you were now referring to the FileName label.

however, it appears that this may actually be a documentation bug.

QFileDialog has an internal property "fileNameLabelExplicitlySat" [sic] 
which is set to true when using setLabelText.

the setFileMode method checks this property when deciding whether to 
reset the FileName label. there is no corresponding property for any of 
the other labels.


More information about the PyQt mailing list