Results 1 to 4 of 4

Thread: Custom Widget gaining Focus

  1. #1
    Join Date
    Dec 2014
    Posts
    49
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5 PyQt3 PyQt4
    Platforms
    Windows

    Default Custom Widget gaining Focus

    I currently have a custom widget that has two children, QLabel and QComboBox. I want to change the stylesheet of the QLabel when the QComboBox gains focus, and loses focus. Currently i have a version working, however, when the QComboBox opens, and the popup displays, QComboBox loses focus ( I presume so that the popup can gain focus ), however, i can not track the popup focus events.

    Suggestions ?

  2. #2
    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: Custom Widget gaining Focus

    Why can't you track popup focus events?
    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.


  3. #3
    Join Date
    Dec 2014
    Posts
    49
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5 PyQt3 PyQt4
    Platforms
    Windows

    Default Re: Custom Widget gaining Focus

    I am not sure how to gain focus of from the popup menu.

    I have solved my issue by overriding showPopup and hidePopup and use them as focus getter.

    Would like a more elegant way of doing this, if you know of one.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Custom Widget gaining Focus

    Sounds pretty elegant to me.

    These two methods indicate the beginning and the end of the "override" state in which your normal tracking doesn't apply.

    Cheers,
    _

Similar Threads

  1. Replies: 3
    Last Post: 4th September 2016, 09:44
  2. Replies: 0
    Last Post: 19th March 2012, 19:09
  3. How to prevent a popup dialog gaining focus
    By chris_helloworld in forum Qt Programming
    Replies: 2
    Last Post: 14th December 2010, 12:47
  4. Replies: 1
    Last Post: 3rd November 2009, 22:26
  5. Replies: 1
    Last Post: 5th August 2008, 20:44

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.