Results 1 to 2 of 2

Thread: QMessageBox Key focus

  1. #1
    Join Date
    Jan 2010
    Posts
    6
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default QMessageBox Key focus

    Hi all

    I have a embedded application where I have 3 hardware push buttons as the only user input. I have linked these buttons to 3 different keyboard keys (Q,W and E) so I can use the button input in my Qt application.
    Therefore throughout my application I use QKeyEvent to tell the application what each button should correspond to depending on where I am in the program. Eg Tab, Space, Up, Down etc

    However when I call a QMessageBox within my Main application like:
    msgBox->warning(this,tr("No Selection made!"),tr("You must choose an Answer to proceed"));

    I cannot get my QKeyEvent to focus on the new message box window, it is still focused on the main window behind it.
    I can press the "OK" button with the space bar on a keyboard but I cant create an event filter to simulate the space bar with the letter W for example.

    How do I get my event filter to focus on the new QmessageBox that has been created or how do I create a seperate Event filter for the message box?


    Please Help

  2. #2
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMessageBox Key focus

    Hi!

    Have you tried to set the focus manually? msgBox->setFocus();

    I'm not sure what you want to say with "event filter to focus".. Do you use msgBox->installEventFilter(this) .. ?

    If that doesn't help you need to show us some code!

    Johannes

Similar Threads

  1. QMessageBox with no focus
    By mpi in forum Qt Programming
    Replies: 0
    Last Post: 27th September 2009, 16:52
  2. Window focus issues (How to force focus to a window?)
    By montylee in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2009, 01:00
  3. QMessageBox and Focus
    By fruzzo in forum Qt Programming
    Replies: 3
    Last Post: 18th November 2008, 19:39
  4. Re: Help on QMessageBox
    By arunvv in forum Newbie
    Replies: 2
    Last Post: 25th March 2008, 23:45
  5. Focus issues / Setting multiple focus
    By ComputerPhreak in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2007, 06:09

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.