Results 1 to 3 of 3

Thread: Get notification/info about which Widget that has focus?

  1. #1
    Join Date
    Mar 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Get notification/info about which Widget that has focus?

    Hi,
    I have a QApplication wich is a screen (GUI) with a lot of widgets (buttons, labels etc) for controlling graphical objects and displaying position information.
    I have a problem that when I press a button (for example to rotate an object) and keep it pressed, the focus is moved somewhere else. For the button to work I have to press quickly or use signal Pressed instead of Clicked. This means for example autorepeat is not working since the button will loose focus for some reason!

    Is there anyway to ask the QApplication wich widget that has focus currently? Or in some other way get focuschange information from all widgets in an easy way so i can troubelshoot why the activated button loose focus.

    BR,
    Jocke
    Last edited by JK; 27th March 2009 at 11:56.

  2. #2
    Join Date
    Jul 2007
    Location
    Bangalore, India
    Posts
    13
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Get notify about which Widgat that has focus?

    See this link to know how to check the current widgets focus state.

    http://doc.trolltech.com/4.2/qwidget.html#focus-prop

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Get notification/info about which Widget that has focus?

    Reading documentation doesn't hurt you know...

    QApplication::focusWidget(), QApplication::activeWindow().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Focus rect not drawing
    By draftpunk in forum Qt Programming
    Replies: 3
    Last Post: 11th November 2008, 15:21
  2. QTableView focus issue
    By gemidjy in forum Qt Programming
    Replies: 4
    Last Post: 19th February 2008, 15:51
  3. Force focus to a QTabWidget page's widget
    By thomaspu in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2008, 06:54
  4. Focus issues / Setting multiple focus
    By ComputerPhreak in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2007, 06:09
  5. Tab/Enter focus problem
    By b1 in forum Qt Programming
    Replies: 4
    Last Post: 23rd October 2006, 23:34

Tags for this Thread

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.