Results 1 to 4 of 4

Thread: How to set StyleSheet for checkbox in QTreeView;

  1. #1
    Join Date
    Jun 2006
    Posts
    23
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How to set StyleSheet for checkbox in QTreeView;

    Is possible to set stylesheet for checkable items in QTreeView.
    QTreeView::item:checked, QCheckBox::indicator:checked are not working:-(

  2. #2
    Join Date
    Jun 2008
    Posts
    88
    Thanks
    4
    Thanked 4 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11
    Wiki edits
    1

    Default Re: How to set StyleSheet for checkbox in QTreeView;

    Just like you would a QCheckBox only with a QTreeView

    QTreeView::indicator:checked {
    image: url(path);
    }
    QTreeView::indicator:unchecked {
    image: url(path);
    }

  3. The following user says thank you to chezifresh for this useful post:

    Snix (10th December 2013)

  4. #3
    Join Date
    Apr 2009
    Posts
    18
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to set StyleSheet for checkbox in QTreeView;

    Quote Originally Posted by chezifresh View Post
    Just like you would a QCheckBox only with a QTreeView

    QTreeView::indicator:checked {
    image: url(path);
    }
    QTreeView::indicator:unchecked {
    image: url(path);
    }
    then if i wanna insert QcheckBox to the QTreeView,how can i do it?

  5. #4
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set StyleSheet for checkbox in QTreeView;

    u dont have to insert QCheckbox as a whole into QTreeView, just set the path to image for checked and unchecked states of the checkbox..these images can be any image u want..just follow what chezifresh wrote.

  6. The following user says thank you to talk2amulya for this useful post:

    lengshuang (26th April 2009)

Similar Threads

  1. QTreeView rows (items) StyleSheet
    By Kostanev in forum Qt Programming
    Replies: 1
    Last Post: 15th September 2007, 10:36

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.