Results 1 to 2 of 2

Thread: QLineEdit and focus

  1. #1
    Join Date
    May 2007
    Qt products
    Qt3 Qt4

    Default QLineEdit and focus

    I've tried to search a forum, but could not find the answer.
    I have a mainwindow with a QLineEdit in the toolbar. I want to brint it to the front, set focus on the application startup, like in Firefox or Konqueror ( No, I am not developing a web browser ). Basically I want QLineEdit in the toolbar to be the active widget of the application at startup.
    I tried setFocus(), raise(), but it does not help.

    grabKeyboard() grabs the keyboard, but it does not make QLineEdit the active widget.

    Can anobody help?


  2. #2
    Join Date
    Jan 2006
    Warsaw, Poland
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits

    Default Re: QLineEdit and focus

    The widget has to be visible to receive focus, so make sure you set the focus only after show() is called (or even later (for example using a timer), when the window is actually displayed).

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

    serega (16th January 2008)

Similar Threads

  1. QLineEdit Focus
    By sulagnp in forum Qt Programming
    Replies: 1
    Last Post: 15th January 2008, 12:25
  2. ScrollBar is not moving properly when I use TAB
    By chikkireddi in forum Qt Programming
    Replies: 15
    Last Post: 25th May 2007, 23:30
  3. QLineEdit lost focus
    By codebehind in forum Newbie
    Replies: 5
    Last Post: 4th May 2007, 17:02
  4. Tab/Enter focus problem
    By b1 in forum Qt Programming
    Replies: 4
    Last Post: 24th October 2006, 00:34
  5. How can i ask if a qlineedit get focus..
    By otortos in forum Newbie
    Replies: 1
    Last Post: 7th April 2006, 19:23


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.