Results 1 to 8 of 8

Thread: getSaveFileName capital extension

  1. #1
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default getSaveFileName capital extension

    Hello everyone,

    I use the getSaveFileName to let the user set the file name as well as the extension, but I want to set a defualt name and a defualt extension.
    the extension i want to set it capital extension, but the dialog shows it as small letter.

    Qt Code:
    1. ex :
    2.  
    3. QString suggestedName = QString("ANYNAME");
    4. QString filter = QString("extension (*.EXT) ;; All Files (*)");
    5. outputFileName = QFileDialog::getSaveFileName(this,"Save file",suggestedName,filter);
    To copy to clipboard, switch view to plain text mode 

    when the save file dialog open it shows .ext small letters not capital, how can i force it to be capital.

    PS: I am using Qt 4.8 on red hat 6.2 desktop KDE

    best regards,

    Jesse.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: getSaveFileName capital extension

    It looks like you may not be able to control this using the QFileDialog::getSaveFileName() static method. However, if you construct the dialog manually, it looks like you can call the QFileDialog::setFilter() method and pass in QDir::CaseSensitive as an option.

    If this still doesn't work, then just grab the extension and capitalize it yourself before creating the file.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: getSaveFileName capital extension

    Why not add the extension to the suggested name?

    Cheers,
    _

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: getSaveFileName capital extension

    On Windows, and Mac OS X the QFileDialog::getSaveFileName() use native file dialog. Remeber that file systems on Windows are case letter independent (i.e. ThisFileNAME is the same thisfilename or THISFILENAME).

  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: getSaveFileName capital extension

    Yes, but the OP states he is using Red Hat 6.2 Desktop. AFAIK, on *nix variants the file system is case sensitive. So if a native file dialog is used, shouldn't it respect the case of filters?

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: getSaveFileName capital extension

    It will, but the given filename does not have an extension.

    The filter is most likely applied case insensitive, as to avoid very different behavior across platforms.

    Cheers,
    _

  7. #7
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: getSaveFileName capital extension

    Thank you for you replays and suggestiong,

    As for adding the extension to the suggested name, I DO add it. I just forgot to put that line in the exmaple. for some reason the extension is filped to small letter too, seems the filters recognize the extension and change it.

    how can i constract the save dialog manulaly, with out using the static method QFileDialog::getSaveFileName() ??

    best regards

  8. #8
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: getSaveFileName capital extension

    Quote Originally Posted by d_stranz View Post
    Yes, but the OP states he is using Red Hat 6.2 Desktop. AFAIK, on *nix variants the file system is case sensitive. So if a native file dialog is used, shouldn't it respect the case of filters?
    And what the blind man's eyes... Of course it should.

Similar Threads

  1. How to force capital letters in input field?
    By falconium in forum Newbie
    Replies: 12
    Last Post: 8th May 2012, 12:07
  2. QInputDialog like QFileDialog::getSaveFileName
    By BIllNo123 in forum Newbie
    Replies: 5
    Last Post: 23rd September 2010, 14:51
  3. Replies: 5
    Last Post: 17th September 2009, 15:41
  4. problem with QFileDialog::getSaveFileName
    By navi1084 in forum Qt Programming
    Replies: 4
    Last Post: 26th June 2009, 07:38
  5. QFileDialog::getSaveFileName default extension
    By elcuco in forum Qt Programming
    Replies: 2
    Last Post: 10th August 2007, 20:13

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.