[Interest] QFileDialog Qt5

Duane duane.hebert at group-upc.com
Thu Dec 17 14:08:34 CET 2015


On 17/12/2015 3:15 AM, Jan Dasselaar wrote:
> On 16-12-2015 15:02, Duane wrote:
>> On 16/12/2015 8:53 AM, Thiago Macieira wrote:
>>> On Wednesday 16 December 2015 08:10:44 Duane wrote:
>>>> I'm subclassing a QFileDialog.  I need to get a pointer to the filename
>>>> box.  I was doing this with findChild<QLineEdit*>() with Qt4 but with
>>>> Qt5 this returns null.  Any suggestions?
>>>
>>> XY problem. Why do you need to get the pointer to the line edit? What
>>> are you
>>> trying to do?
>>>
>>
>> Not sure what you mean by XY problem.
>>
>> We're trying to do something like a "save as" where depending on the
>> setup the user can enter a filename with the directory path. We block
>> the context menu that allows creating new files etc.
> You can also use the setOptions(QFileDialog::ReadOnly) flag.
> When set the Rename, Delete and New Folder items in the context menu
> will be disabled.



We have that set.  So when we wanted to use it as a "save as" dialog we 
needed to allow the user to type a new filename so we were grabbing that 
directly and returning it with the path selected in the dialog.
This seems to work now when AnyFile is set.

This was written some years ago so I can only think that either setting 
AnyFile somehow didn't return the user's choice or there was a bug in 
some particular version.





More information about the Interest mailing list