Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jan 2010

    Styling checkmark in QCheckBox?


    I have an application using QT where one of the Widgets is styled through stylesheets to have a white background color and black text and a number of QCheckBoxes.

    This works well in most cases, but fails is the user is using the standard "Golden Business" themes, as all text, borders, checkmarks etc in the QCheckBoxes when then be white on white...

    I would therefore like to know whether it is possible to access and style the checkmark in a QCheckBox to e.g. have a black color? Also, is there any way to style the "focus rectangle" as it moves down the list of QCheckBoxes?

    (I have found some examples on http://doc.trolltech.com/4.3/stylesh...zing-qcheckbox which seems to use images for all states, but would to know whether I can solve the task without having to create and maintain a larger number of images. Besides that, I have previously found examples on the same page that didn't work, so I would like to know whether anybody in this group could help me out with a working solution).


  2. #2
    Nokia Developer Expert
    Join Date
    Feb 2008

    Re: Styling checkmark in QCheckBox?


    AFAIK you cannot set the color of an indicator in stylesheet (its valid syntax, but apparently not supported), but you can style the indicator states with images
    (I have done it and it works).

    The focus frame (in 'stylespeak' this is style part CE_FocusFrame) is unfortunately not stylesheet stylable.

    If you have found out errors in that particular document, please report them as errors to http://bugreports.qt.nokia.com/. There's no excuse having erroneous or
    invalid documents hanging around.


  3. #3
    Registered User
    Join Date
    Jan 2010

    Re: Styling checkmark in QCheckBox?

    Hi Fuzzbender

    Thanks for the answer. If you have had luck with the image approach before I will certainly use the time to try the same approach myself. Thanks.

    (Related to the http://doc.trolltech.com/4.6/stylesheet-examples.html I can't at present remember which exact examples that didn't work, but will look in to it, when I get the time. However, I think that most of the problems was due to errors in the number of colons, e.g. in

    QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal

    where there is one colon before "left-arrow" and two colons before "right-arrow", which I believe is a mistake.

    Being new at this, it's frustrating when copy'n'pasting of examples doesn't work, since you then don't know whether it the examples, the phone, the emulator, QT or yourself that needs to be fixed :-|

    But thanks for your help, which I will try soon.


Similar Threads

  1. S40 CSS compatibility and styling links
    By miohtama in forum Browsing and Mark-ups
    Replies: 2
    Last Post: 2009-10-15, 12:21
  2. Replies: 4
    Last Post: 2005-08-02, 07:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts