Qt: 4.6.2 Commercial
Windows XP
My app is a configuration tool. When a user has setup things to their satisfaction they are to save the configuration to disk. The problem is that the configuration is actually a group of files. To the user I must make a directory (and its contents) look like the configuration (a single entity).
Using QFileDialog I can view the directory where the configurations are to be stored (Configs in the example below).
My problem is getting QFileDialog to allow me to save. If the destination directory exists (the 'Save' case) this is not a problem. But, if the user wants to do 'Save As' the QFileDialog will disable the Save button as soon as a non-existing directory name is typed.
Directory Structure Example:
+--Configs
| |
| +--Configuration_1
| | |
| | +--<actual configuration files>
| |
| +--Configuration_2
| | |
| | +--<actual configuration files>
I need to be able to type in a directory name (ex. Configuration_3) and have the Save button enabled so when the QFileDialog exits I can handle all the actual directory and file creation.
Is what I'm trying to do possible using QFileDialog?
fileDlg.setWindowTitle( sDlgTitle );
fileDlg.setDirectory( sConfigPath );
if ( fileDlg.
exec() == QDialog::Rejected ) return;
QString sConfigPath
= (fileDlg.
selectedFiles())[0];
QFileDialog fileDlg( this );
fileDlg.setWindowTitle( sDlgTitle );
fileDlg.setDirectory( sConfigPath );
fileDlg.setFileMode( QFileDialog::DirectoryOnly );
fileDlg.setOptions( QFileDialog::ShowDirsOnly );
fileDlg.setAcceptMode( QFileDialog::AcceptSave );
if ( fileDlg.exec() == QDialog::Rejected )
return;
QString sConfigPath = (fileDlg.selectedFiles())[0];
To copy to clipboard, switch view to plain text mode
Bookmarks