PDA

View Full Version : QInputDialog like QFileDialog::getSaveFileName



BIllNo123
23rd September 2010, 14:59
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

tbscope
23rd September 2010, 15:24
QInputDialog::getText ?

BIllNo123
23rd September 2010, 15:32
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.

tbscope
23rd September 2010, 15:36
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?

BIllNo123
23rd September 2010, 15:44
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.

BIllNo123
23rd September 2010, 15:51
------------------