Results 1 to 3 of 3

Thread: Focus Out problem

  1. #1
    Join Date
    Apr 2011
    Posts
    4
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Focus Out problem

    I've tried some controls of QT e.g. QLineEdit. I found that they are not giving focus out event even though it should as per standard behavior. Previously I was using wxWidget and in wxWidget has fine controls over focus. In wxWidget if I am clicking out side the text box, text box regularly gives me Kill focus event. But its not here case with Qt.

    Can any body tell me if I am doing something wrong?
    Basically I want to receive focus lost event whenever I click outside QLineEdit. If its not possible with QLineEdit please let me know if any other control can perform similar...

    Thanks,
    Chirag.

  2. #2
    Join Date
    Feb 2007
    Location
    Italy
    Posts
    69
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Focus Out problem

    Hi,
    Qt has a fine control over focus, too.
    I think your problem is the focus policy: one widget at time may have the focus, and if one has it, you shall pass the focus to another widget to remove it or clear the focus for that widget. In Qt, QWidget has by default the policy of not accepting focus, while QLineEdit has the policy of accepting it: this is why, if you click on another input field, the original focus is loosed.
    If you want to clear the focus from your QLineEdit by just clicking the window, cou can call yourWindow->setPolicy(Qt::StrongFocus).
    HIH
    ~Aki

  3. The following user says thank you to akiross for this useful post:

    Chirag (2nd May 2011)

  4. #3
    Join Date
    Apr 2011
    Posts
    4
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Focus Out problem

    Thanks a lot akiross! It fixed my problem! But I want to know little bit more if there is any side affect of setting strong focus on main window.

Similar Threads

  1. OnScreenKeyboard tab focus problem
    By BalaQT in forum Qt Programming
    Replies: 6
    Last Post: 25th March 2011, 09:13
  2. Problem of Focus QMacNativeWidget
    By skuallpa in forum Qt Programming
    Replies: 1
    Last Post: 21st July 2010, 14:19
  3. Focus problem
    By waynew in forum Qt Programming
    Replies: 4
    Last Post: 1st May 2010, 01:24
  4. QLineEdit focus problem
    By matteo.cozzaglio in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2009, 14:13
  5. Tab/Enter focus problem
    By b1 in forum Qt Programming
    Replies: 4
    Last Post: 23rd October 2006, 23:34

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.