Results 1 to 4 of 4

Thread: How to get Qmessagebox output?

  1. #1
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default How to get Qmessagebox output?

    How to get the button event of the Qmessage box?

    If cancel button is clicked, it should reject?? How to reject the process when cancel button is pressed in the message box??

  2. #2
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to get Qmessagebox output?

    please read the documentation of QMessageBox. If you are using static methods, evaluate the return value. if you use exec(), you get the clicked button with "QAbstractButton * clickedButton () const".

    the part of "rejecting the process" has nothing to do with qt, that's part of your program logic.

  3. #3
    Join Date
    May 2010
    Posts
    61
    Thanks
    2
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to get Qmessagebox output?

    You can QDialog::exec the message box and test for the result:
    Qt Code:
    1. if (QMessageBox::Cancel == msgBox.exec)
    To copy to clipboard, switch view to plain text mode 

    Hope this is useful.

    Regards,
    Wladek
    One second is long, everything longer than two seconds is definitely too long.

  4. #4
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to get Qmessagebox output?

    Qt Code:
    1. 1.
    2. if (msgBox.exec==QMessageBox::Cancel )
    To copy to clipboard, switch view to plain text mode 

    This works fine.

Similar Threads

  1. Replies: 8
    Last Post: 27th September 2010, 14:10
  2. QMessageBox
    By sonuani in forum Qt Programming
    Replies: 13
    Last Post: 2nd September 2009, 17:56
  3. QMessageBox
    By sonuani in forum Qt Programming
    Replies: 1
    Last Post: 31st March 2008, 08:27
  4. Re: Help on QMessageBox
    By arunvv in forum Newbie
    Replies: 2
    Last Post: 25th March 2008, 23:45
  5. how to use tr() for QMessageBox?
    By gfunk in forum Qt Programming
    Replies: 4
    Last Post: 17th November 2007, 11:30

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.