[SOLVED] How to stylize checkable items in a QAbstractItemModel-based model?



  • Suppose a column inside a QAbstractItemModel-based model has the Qt::ItemIsUserCheckable flag of one of the columns set.
    If the model is set to a let's say QTableView, the column displays the native checkbox's state images. Is there a way using a stylesheet set to the QTableView (for instance, could be any QAbstractItemView) or somehow inside the model to provide custom images for the different check states?


  • Moderators

    @
    QTableView::indicator
    {
    image: url(":/checkbox.png");
    }

    QTableView::indicator:unchecked:pressed
    {
    image: url(":/checkbox-unchecked.png");
    }

    QTableView::indicator:checked:pressed
    {
    ...
    }
    @

    use more pseudo states if needed...



  • Great, thanks. I tried without the indicator sub-element.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.