Results 1 to 4 of 4

Thread: Change Color of Focus Frame

  1. #1
    Join Date
    Jun 2006
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Change Color of Focus Frame

    Using Qt 4.5.3, I'm unable to change the color of the "focus frame" via a style sheet.

    focus_frame.png

    Suggestions?

    Background: My astronomy app changes the color of every screen element to either black or a shade of red, to preserve dark adaptation at the telescope. Qt's style sheets work really well to accomplish this task.

    Thanks so much for your consideration.

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Change Color of Focus Frame

    From the documentation:

    "The color and background of the selected item is styled using selection-color and selection-background-color respectively."

    Does this work for you?
    It's nice to be important but it's more important to be nice.

  3. #3
    Join Date
    Jun 2006
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Change Color of Focus Frame

    Thanks for taking the time to respond.

    Quote Originally Posted by axeljaeger View Post
    From the documentation:

    "The color and background of the selected item is styled using selection-color and selection-background-color respectively."

    Does this work for you?
    Although these styles work as advertised, neither change the color of the focus frame rectangle that is drawn around the selection. (FWIW, I use the QListBox widget in the Qt Style Sheet example for testing.)

    I've also tried altering QFocusFrame styles to no avail, which makes me think I'm still barking up the wrong tree.

  4. #4
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Change Color of Focus Frame

    Does subclassing QStyle and reimplementing drawControl with argument "element" set to CE_FocusFrame work for you?
    It's nice to be important but it's more important to be nice.

Similar Threads

  1. how to change the color of the frame
    By wagmare in forum Qt Programming
    Replies: 5
    Last Post: 12th May 2009, 12:46
  2. focus frame
    By panduro in forum Qt Programming
    Replies: 1
    Last Post: 23rd June 2008, 09:57
  3. Change focus on QToolBox
    By mattia in forum Newbie
    Replies: 1
    Last Post: 20th December 2007, 08:56
  4. Change the shape of a frame.
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 13th November 2007, 06:40
  5. Replies: 15
    Last Post: 26th July 2007, 21:04

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.