hi,
I want a messagebox with no icon and with ok button alone.
I wrote my code like this.
QMessageBox::information(Parent,Title,msg,QMessage Box::Ok);
It displays a information icon.
I dont want it.How to remove that.
THANKS
Printable View
hi,
I want a messagebox with no icon and with ok button alone.
I wrote my code like this.
QMessageBox::information(Parent,Title,msg,QMessage Box::Ok);
It displays a information icon.
I dont want it.How to remove that.
THANKS
So don't use QMessageBox::information() which sets the informative icon but instantiate a QMessageBox without any icon.
I tried like this ...But the MessageBox is appearing for a second and then disappears.Wt to do???
Code:
msg->show();
Could you show us the actual code?
I m trying to convert the below vc++ code to Qt.
::MessageBox(Parent->m_hWnd, msg, title, MB_OK);
And i have sent u the actual code i had replaced previously.
Use exec() instead of show().
It should remain visible because you allocate it on the heap, but what if you do:
Now the messagebox is appearing properly.If i click on the ok button then the messagebox should close.
At present the messagebox is getting closed only after I click on ok button 2 times.Why is that so???
Could it be that the function containing the code gets called twice? Try setting a breakpoint at the line before exec().
hi,
when i debug the control passes through the messagebox only once.But when i execute it it gets displayed 2 times (i.e If i give ok to the first messagebox then another one appears)
What is the problem with my code?
Thanks.
Could you show us the relevant code?
Actually when i press enter to close the messagebox.Eventfilter in my class is getting called again and messagebox is getting displayed again.
How to differenciate between the enter that i pressed to close the messagebox and the ordinary enter that i press ...
This is rather old post but here’s why this is happening in case someone else has a same problem. When you press a key on keyboard (and release it, thus actually making one “click” of that key) there are two events emitted. QEvent::KeyPress and then QEvent::KeyRelease. The first one closes the message box and object that gets the focus (after closing message box) also gets QEvent::KeyRelease called for it, which causes that object to “think” that key was pressed inside it. Filter out QEvent::KeyRelease event for object that can get focus after message box closes. Worked for me :D