Results 1 to 5 of 5

Thread: QCheckBox change color

  1. #1
    Join Date
    Dec 2008
    Location
    PUNE (INDIA)
    Posts
    49
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QCheckBox change color

    Hi all Experts ,
    I have developed a QTreeView in which items has checkboxes in front of them , so that they are selectable .
    I want to change the color of the box to a specific color when the item is checked or unchecked .
    I had tried to chage the color of it specified in the forum but unfortunately didn't work.
    Please give me a hint to do so.
    I have attached the image to make you understand my requirement.
    Attached Images Attached Images
    Thanks & Regards ,

    Vajindar Laddad .
    Trainee Developer.
    (INDIA).
    91+9325014248

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QCheckBox change color

    You can use style sheets for that.

  3. #3
    Join Date
    Dec 2008
    Location
    PUNE (INDIA)
    Posts
    49
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCheckBox change color

    Can we apply stylesheets to QStandardItem ??
    I think we need to do casting ... is it correct ??
    Thanks & Regards ,

    Vajindar Laddad .
    Trainee Developer.
    (INDIA).
    91+9325014248

  4. #4
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QCheckBox change color

    Can you try calling void QStandardItem::setBackground ( const QBrush & brush ) and see the result ?

  5. #5
    Join Date
    Dec 2008
    Location
    PUNE (INDIA)
    Posts
    49
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCheckBox change color

    Hi yogesh ,Thanx for a reply.
    I have tried that .. it changes the tick color and the text of it ..
    but my requirement is quite different.
    Is there any other solution to do the same ?
    Thanks & Regards ,

    Vajindar Laddad .
    Trainee Developer.
    (INDIA).
    91+9325014248

Similar Threads

  1. Disabling the user to change QCheckBox checkstate
    By ChiliPalmer in forum Qt Programming
    Replies: 1
    Last Post: 26th September 2009, 17:20
  2. How to change defualt color of QCheckbox box?
    By darshan.hardas in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2008, 14:24
  3. how to change backgroup color, button color and shape?
    By lzha022 in forum Qt Programming
    Replies: 10
    Last Post: 16th June 2008, 23:25
  4. How to change color of a QPushButton?
    By vishal.chauhan in forum Qt Programming
    Replies: 6
    Last Post: 5th March 2008, 14:22
  5. statusBar() message color change
    By mclark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2007, 00:20

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.