[Solved] Remove OK button from QMessageBox?



  • Hi,
    I am creating a QMessageBox as below:

    @QMessageBox *msg = new QMessageBox();
    msg->setText("My Text");
    msg->setTitle("My Title");
    msg->exec();@

    By default it is showing the OK button.
    I want to remove that button.
    In fact I do not want any button.
    What is the function to do this?
    I have tried removing it by using buttons() to get a list of buttons & then removing them but this does not work.


  • Moderators

    Hi,

    Did you try
    @msg->setStandardButtons(0);@

    ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.