Results 1 to 6 of 6

Thread: QInputDialog like QFileDialog::getSaveFileName

  1. #1
    Join Date
    Aug 2010
    Posts
    16
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default QInputDialog like QFileDialog::getSaveFileName

    Hello all,

    i use QinputDialog so user can give a string which is stored in an array. I check if the string already exists in the array then the user should be prompt for overwrite or not. But when user clicks ok in qinputdialog, it closes. In other words i want something like QFileDialog::getSaveFileName, but for QInputDialog.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QInputDialog like QFileDialog::getSaveFileName

    QInputDialog::getText ?

  3. #3
    Join Date
    Aug 2010
    Posts
    16
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QInputDialog like QFileDialog::getSaveFileName

    I want to prompt user to choose whether he wants to overwrite the string or set another name. The problem is that the QinputDialog closes when user clicks OK.
    Try something like this using the QFileDialog::getSaveFileName. The modal dialog doesn't close but there is a message box "Do you want to replace the file" and user can choose. If user chooses no, the modal dialog is still open and user can insert another name.

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QInputDialog like QFileDialog::getSaveFileName

    I guess you'll need to write your own input dialog. Or subclass the existing one.

    Why not simply show a message dialog and show the input dialog again when the user selected no?

  5. The following user says thank you to tbscope for this useful post:

    BIllNo123 (24th September 2010)

  6. #5
    Join Date
    Aug 2010
    Posts
    16
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QInputDialog like QFileDialog::getSaveFileName

    Quote Originally Posted by tbscope View Post
    I guess you'll need to write your own input dialog. Or subclass the existing one.

    Why not simply show a message dialog and show the input dialog again when the user selected no?
    I subclassed and reimplemnted the "void done(int)" method which is meant to be the one that closes the dialog, but with no success (it wasn't called at all - maybe something else goes on when the user clicks OK).
    Anyway, if there are no other ideas, i guess i'll go with the simple solution.

  7. #6
    Join Date
    Aug 2010
    Posts
    16
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QInputDialog like QFileDialog::getSaveFileName

    ------------------

Similar Threads

  1. problem with QFileDialog::getSaveFileName
    By navi1084 in forum Qt Programming
    Replies: 4
    Last Post: 26th June 2009, 07:38
  2. file name returned by QFileDialog::getSaveFileName()
    By Lexrst in forum Qt Programming
    Replies: 2
    Last Post: 20th June 2008, 16:38
  3. A question about QFileDialog::getSaveFileName
    By Ali in forum Qt Programming
    Replies: 1
    Last Post: 12th October 2007, 19:46
  4. QFileDialog::getSaveFileName default extension
    By elcuco in forum Qt Programming
    Replies: 2
    Last Post: 10th August 2007, 20:13
  5. QFileDialog::getSaveFileName issues with filename
    By dugs in forum Qt Programming
    Replies: 2
    Last Post: 11th December 2006, 17:17

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.