PDA

View Full Version : "new QFileDialog" vs. "getSaveFileName" drive names



Rayven
31st October 2008, 17:19
I have created an new QFileDialog to get the save filename. However, the drive chooser does not list the drive names just the letters. For instance:
"Local Disk (C:)" just prints as "C:". This is VERY frustrating when there are multiple networked drives and all I see are W, X, Y and Z printed.

To make matters more confusing if I use the static getSave/OpenFileName calls, the drive names appear correctly.


QString filename = QFileDialog::getSaveFileName( this, tr("Save"), QDir::home( ) );


vs



QFileDialog *saveDialog = new QFileDialog( this, tr("Save"), QDir::home( ) );
saveDialog->setAcceptMode( QFileDialog::AcceptSave );

if( saveDialog->exec( ) ) ...


Is there something that I need to set to make the drive letters appear?

Thanks

pastor
2nd November 2008, 13:11
In first case, the static functions (getSave/OpenFileName) will use the native file dialogs and not a QFileDialog. This behaviour will occur Under Windows and Mac OS X only.

In second case - will use QFileDialog. And I don't see any ways how to display drive names :(. You can set detail view mode of the file dialog:


QFileDialog *saveDialog = new QFileDialog( this, tr("Save"), QDir::home( ) );
saveDialog->setAcceptMode( QFileDialog::AcceptSave );
saveDialog->setViewMode(QFileDialog::Detail);

if( saveDialog->exec( ) ) ...


it's better than nothing ;)