Results 1 to 14 of 14

Thread: QMessageBox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    3
    Thanked 4 Times in 4 Posts

    Default Re: QMessageBox

    Quote Originally Posted by spud View Post
    Could it be that the function containing the code gets called twice?
    But that should result in two separate messagebox windows.

  2. #2
    Join Date
    Feb 2008
    Posts
    47
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Post Re: QMessageBox

    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.

  3. #3
    Join Date
    Oct 2006
    Posts
    279
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    6
    Thanked 40 Times in 39 Posts

    Default Re: QMessageBox

    Could you show us the relevant code?

  4. #4
    Join Date
    Feb 2008
    Posts
    47
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Post Re: QMessageBox

    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 ...

  5. #5
    Join Date
    Aug 2009
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Lightbulb Re: QMessageBox

    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

Similar Threads

  1. Re: Help on QMessageBox
    By arunvv in forum Newbie
    Replies: 2
    Last Post: 26th March 2008, 00:45
  2. QMessageBox problem in Qtopia
    By jogeshwarakundi in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 8th February 2008, 10:22
  3. QMessageBox - no dialog title on Mac OS?
    By will49 in forum Qt Programming
    Replies: 1
    Last Post: 8th October 2007, 15:07
  4. customize the Icon QMessageBox
    By QiT in forum Newbie
    Replies: 1
    Last Post: 26th August 2006, 11:40
  5. Change icons on static QMessageBox
    By manucorrales in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2006, 20:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.