QMessageBox won't close using setStandardButtons(0);



  • All,
    I launch a standard QMessageBox using:
    @
    dialogBox = new QMessageBox( this );
    dialogBox->setAttribute( Qt::WA_DeleteOnClose ); //makes sure the msgbox is deleted automatically when closed
    dialogBox->setText("Device rebooting");
    dialogBox->setInformativeText("Please wait for device to reboot.");
    dialogBox->setStandardButtons(0);

        dialogBox->open( this, NULL);
    

    @

    but if I call:
    @
    dialogBox->close();
    @

    Nothing happens, and the MessageBox will not close. However, If I include a standard button:
    @msgBox->setStandardButtons(QMessageBox::Cancel); @

    It will close just fine with:
    @dialogBox->close();@

    Any Ideas?

    Thanks,
    Terry


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you try with done(0) ?



  • Done(0) works great!!

    Thanks!
    Terry


  • Lifetime Qt Champion

    You're welcome !

    Since you have your message box working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)


Log in to reply
 

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