[Solved] QMessagebox that cannot be closed by user?
-
Hi,
I am displaying a QMessageBox to the user in a situation, where I want to have control when the message box can be closed.
It would not be a good UX if I kept the close & OK buttons & implemented some function to ignore them, because the user would then be expecting the window to close. So my requirement is:- Remove close button
- Remove the OK button
- Make it impossible for the user to be able to close the message box
Here is the code:
@ QMessageBox *msg = new QMessageBox();
msg->setText("My Text");
msg->setWindowTitle("My Title");
msg->show();
while(condition)
{
//some stuff
}
msg->close();
delete msg;@I tried by setting the windowflags, but instead removing close button, it added minimise & maximise buttons.
Any suggestions? -
Hi,
In that case, why not just show something like a frameless QLabel ?
-
Hi SGaist,
Can you tell me how to get a frameless QLabel?
Some code please?
Because when I replace QMessageBox with QLabel in above code I am getting minimise, maximise & close buttons as well.
Somehow the window flags just dont work... -
Yes, That Is why I am asking about QMessageBox... :)
-
IIRC, using Qt::FramelessWindowHint