Results 1 to 4 of 4

Thread: QFileDialog::getSaveFileName doesn't show file name.

  1. #1
    Join Date
    Jun 2008
    Location
    Rome, Italy
    Posts
    95
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QFileDialog::getSaveFileName doesn't show file name.

    Hi to all,
    I'm using Qt 2009.03 version and getting strange behavior with the following code:

    Qt Code:
    1. QString nomeFile;
    2. nomeFile = QString
    3. (
    4. "Export_%1.txt"
    5. )
    6. .arg(QDate::currentDate().toString("yyyy-MM-dd"));
    7.  
    8. qDebug() << "nomeFile : " << nomeFile;
    9. //show exactly "Export_2009-07-23.txt"
    10.  
    11. QString nomeFileScelto = QFileDialog::getSaveFileName
    12. (this, tr("Salva il File"), nomeFile,
    13. tr("File da Esportare (Export*.txt)"));
    To copy to clipboard, switch view to plain text mode 

    it opens a Dialog (S.O.: Windows XP) without the suggested file name (nomeFile), just a blank box while the filter is OK!

    The previous release didn't have that problem, if I remember right, any ideas?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QFileDialog::getSaveFileName doesn't show file name.

    What if you prepend it with an absolute directory path?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2008
    Location
    Rome, Italy
    Posts
    95
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QFileDialog::getSaveFileName doesn't show file name.

    I've tried:

    1. Qt Code:
      1. QString nomeFile;
      2. nomeFile = QString
      3. (
      4. "./Export_%1.txt"
      5. )
      6. .arg(QDate::currentDate().toString("yyyy-MM-dd"));
      To copy to clipboard, switch view to plain text mode 

    2. Qt Code:
      1. QString nomeFile;
      2. nomeFile = QString
      3. (
      4. ".Export_%1.txt"
      5. )
      6. .arg(QDate::currentDate().toString("yyyy-MM-dd"));
      To copy to clipboard, switch view to plain text mode 

    3. Qt Code:
      1. QString nomeFile;
      2. nomeFile = QString
      3. (
      4. "C:\Export_%1.txt"
      5. )
      6. .arg(QDate::currentDate().toString("yyyy-MM-dd"));
      To copy to clipboard, switch view to plain text mode 


    but nothing happen

  4. #4
    Join Date
    Jun 2008
    Location
    Rome, Italy
    Posts
    95
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QFileDialog::getSaveFileName doesn't show file name.

    In the following way:

    Qt Code:
    1. QString nomeFile;
    2. nomeFile = QString
    3. (
    4. QDir::currentPath() + "/Export_%1.txt"
    5. )
    6. .arg(QDate::currentDate().toString("yyyy-MM-dd"));
    To copy to clipboard, switch view to plain text mode 

    it works!!!

    thanks!

Similar Threads

  1. How to show up .Ui file?
    By lengshuang in forum Newbie
    Replies: 2
    Last Post: 29th April 2009, 10:26
  2. use QDialog to show file name
    By damonlin in forum Qt Programming
    Replies: 3
    Last Post: 16th November 2008, 13:52
  3. qdirmodel question: show file number of a folder?
    By zl2k in forum Qt Programming
    Replies: 3
    Last Post: 7th November 2008, 07:07
  4. Display a file from Directory tree to show in QTextEdit
    By vvdounai in forum Qt Programming
    Replies: 1
    Last Post: 13th November 2007, 13:43
  5. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21

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.