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.
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
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
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.
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.