QMessageBox Non-Modal using signal/slot
-
Hi,
I looked online and couldn't find an answer although I'm sure there must be a solution somewhere.
I have a QMessageBox which is currently modal and uses exec() to display the text. The method that uses QMessageBox is located in a slot. If I set the modal flag to false I need to use show() instead of exec() but as we know if I use show(), the life of the messageBox is in scope for as long we are in the slot and then the box disappears., so essentially I see a flashing box when the slot gets called. I only have one button (OK) in the messageBox to close it.
Can someone please explain how I can continue to use the slot (requirement) when calling QMessageBox and still make it non-modal?
Thanks in advance!
-
@VRonin said in QMessageBox Non-Modal using signal/slot:
QMessageBox* msgBox= new QMessageBox(QMessageBox::Information,tr("Title"),tr("Text"),QMessageBox::Ok,this);
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->show();Hmm, still modal. What seems to work is if I make msgBox a private variable in the class but would prefer if we can use your method if I can get it to work.