Results 1 to 3 of 3

Thread: Proper use of an InputDialog box - capture CANCEL click

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2017
    Posts
    55
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Proper use of an InputDialog box - capture CANCEL click

    I have the following function that is a SIMPLE password input dialog.

    It works except that I cannot capture and process the CANCEL button click.
    When CANCEL is clicked I want the dialog box to close without doing anything.
    I have the cancel variable for the button click return but cannot get it done.

    Here's the function
    Qt Code:
    1. int class::display_password_dialog()
    2. {
    3. QString retarg;
    4. bool cancel;
    5.  
    6. do
    7. {
    8. retarg = QInputDialot::gettext(0,"Password Entry", "Type Password, Press Ok: ",QLineEdit::Normal, "***", &cancel);
    9. std::cout <<"user entered"<< retarg.toStdString()<<std::endl;
    10. if(cancel)
    11. {
    12. std::cout<<"Cancel pressed"<<std::endl;
    13. return EXIT_FAILURE;
    14. }
    15. } while (retarg != "'");
    16. return EXIT_SUCCESS;
    17. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by emp1953; 9th November 2017 at 21:41. Reason: typo

Similar Threads

  1. Replies: 0
    Last Post: 24th May 2016, 12:53
  2. Replies: 1
    Last Post: 3rd April 2016, 00:10
  3. Proper handling "Cancel" click for QWizard
    By Splinter in forum Qt Programming
    Replies: 4
    Last Post: 17th September 2012, 14:34
  4. Replies: 2
    Last Post: 16th July 2012, 12:40
  5. Replies: 3
    Last Post: 5th July 2009, 17:22

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.