Yogesh M
http://sparklemedia.sourceforge.net/
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![]()
Bookmarks