You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, July 23rd 2009, 9:25pm

Using QFileDialog to have user specify sub directory but not modify filename.

Is there a way to have QFileDialog let the user specify a subdir to save a file but have the filename constant so that the user can not change it? Esseentially, I want the application to pick a filename based on entered data, then have the user specify a subdir under a base directory to save the file (displaying the filename being saved).

Thanks very much,

--Greg

2

Friday, July 24th 2009, 3:10pm

RE:Using QFileDialog to have user specify sub directory but not modify filename.

Hi,

I thing you may use getExistingDirectory member function to get the directory to which the file to be saved .

Source code

1
2
QString dirName = QFileDialog::getExistingDirectory( this , tr("Select directory") , tr("/home/krd"), QFileDialog::ShowDirsOnly );
       


thanks,
krd

3

Wednesday, July 29th 2009, 3:37pm

Thanks.. However, I think this will still allow a traversal up the tree. I want to keep the user from selecting above a base directory as well. thanks for the reply.

profox

Trainee

  • "profox" is male

Posts: 111

Location: Belgium

  • Send private message

4

Wednesday, July 29th 2009, 4:37pm

I'm pretty sure you'll have to roll your own filedialog for that.
I don't think that the major supported operating systems have a native filedialog which supports that.