Results 1 to 2 of 2

Thread: "new QFileDialog" vs. "getSaveFileName" drive names

  1. #1
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default "new QFileDialog" vs. "getSaveFileName" drive names

    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.
    Qt Code:
    1. QString filename = QFileDialog::getSaveFileName( this, tr("Save"), QDir::home( ) );
    To copy to clipboard, switch view to plain text mode 

    vs

    Qt Code:
    1. QFileDialog *saveDialog = new QFileDialog( this, tr("Save"), QDir::home( ) );
    2. saveDialog->setAcceptMode( QFileDialog::AcceptSave );
    3.  
    4. if( saveDialog->exec( ) ) ...
    To copy to clipboard, switch view to plain text mode 

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

    Thanks
    Every little child knows
    if you cant see dreams
    your eyes are blind

    Moxy Fruvous

  2. #2
    Join Date
    Oct 2008
    Posts
    70
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Default Re: "new QFileDialog" vs. "getSaveFileName" drive names

    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:

    Qt Code:
    1. QFileDialog *saveDialog = new QFileDialog( this, tr("Save"), QDir::home( ) );
    2. saveDialog->setAcceptMode( QFileDialog::AcceptSave );
    3. saveDialog->setViewMode(QFileDialog::Detail);
    4.  
    5. if( saveDialog->exec( ) ) ...
    To copy to clipboard, switch view to plain text mode 


    it's better than nothing

Similar Threads

  1. QFtp way of knowing drive names
    By baray98 in forum Qt Programming
    Replies: 1
    Last Post: 21st April 2008, 22:51

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.