Results 1 to 5 of 5

Thread: disabled QCheckBox text stylesheet: how to get rid of / change color of etch effect

  1. #1
    Join Date
    Nov 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default disabled QCheckBox text stylesheet: how to get rid of / change color of etch effect

    I'm making a very red and black style, but I can't seem to get rid of the non-red on the etch effect for disabled QCheckBox elements: http://i.imgur.com/pzDEE.png (last checkbox is disabled, and looks wrong).

    The relevant parts of my stylesheet look like this: http://pastebin.ca/2005571

    I found etch-disabled-text, and tried setting it to "0" and "0px" but it didn't help.

    Using QT 4.7.0 on Ubuntu 10.10.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,716
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: disabled QCheckBox text stylesheet: how to get rid of / change color of etch effe

    I found etch-disabled-text
    Where did you 'find' it?
    I can't find such a property in the documentation.
    It makes also no sense, since its a mix of a sub control and a state, and these are sperated in the style sheet syntax.
    You probably are looking for 'idicator' sub control.
    http://doc.trolltech.com/4.7/stylesh...#indicator-sub
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Nov 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: disabled QCheckBox text stylesheet: how to get rid of / change color of etch effe

    I found it using google, in the qtopia documentation. http://doc.qt.nokia.com/qtopia4.3/st...reference.html (search for "etch" within this page and you'll find a reference to it).

    It is my understanding that the ::indicator is the actual check / unchecked graphic. I actually already use this to use a custom graphic and it works well. However, the problem is not the graphic. The problem is the disabled text style, which I cannot figure out how to change.

    *edit* I can verify that the "QCheckBox::disabled" selects the correct component - if I change the "color" value I see the font color change as expected. The problem is that no matter the color setting, the font always has the disabled etched look with the etch being the wrong color.


    Added after 1 51 minutes:


    I made some progress. In the code I managed to change this color like this:
    Qt Code:
    1. QPalette p = QApplication::palette();
    2. p.setColor(QPalette::Disabled, QPalette::Light, QColor(255,0,0));
    3. QApplication::setPalette(p);
    To copy to clipboard, switch view to plain text mode 

    So apparently that disabled text etch effect takes the color from for the role disabled, with the ColorGroup "Disabled" and the ColorRole "Light".

    Now I just need to work out how to get the same effect from the stylesheet...
    Last edited by matthewg42; 2nd December 2010 at 14:22.

  4. #4
    Join Date
    Nov 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: disabled QCheckBox text stylesheet: how to get rid of / change color of etch effe

    Looks like I'm not the only one with this problem: http://lists.trolltech.com/pipermail...st/026312.html

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,716
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: disabled QCheckBox text stylesheet: how to get rid of / change color of etch effe

    since I can't find the etch property in the property list, not the documentation you linked to nor any other, I think this is either pseudo code or something else, probably this examples should not be there.

    It might be that this issue (disabled text color shadow) is not stylable through style sheet, for what ever reason.
    If this is the case, you are stuck with QPalette.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 3
    Last Post: 22nd January 2010, 17:46
  2. QCheckBox change color
    By vajindarladdad in forum Newbie
    Replies: 4
    Last Post: 6th October 2009, 09:33
  3. How to change defualt color of QCheckbox box?
    By darshan.hardas in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2008, 14:24
  4. how to change text color in QTableView?
    By phillip_Qt in forum Qt Programming
    Replies: 2
    Last Post: 28th April 2008, 11:03
  5. Does etch-disabled-text work?
    By WinchellChung in forum Newbie
    Replies: 1
    Last Post: 24th January 2008, 06:19

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.