Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Style checkbox for a QStandardItem.



  • I have a QStandardItem that at some point I make checkable

    thumbIitem->setCheckable(true);
    

    I would like to use my own icons for the checkbox though.

    The only thing I could find was this answer on SO, but I am not sure how It can be applied in my case.

    Does anyone know how to do this?



  • Hi,

    have you tried to use that solution? What's the results?



  • No I have not. Mostly because I am not sure how.

    Obviously simply typing

    thumbIitem::indicator:checked
      {
        image: url(.../Checkbox_checked_normal.png);
      }
    

    Is not correct.
    Since I have not cared much about stylesheets and appearance until now, I don't know how to proceed.

    Edit:
    Also, Hi :)



  • Hi,

    have a look to QWidget::setStyleSheet()



  • use this
    QComboBox QAbstractItemView {
    selection-background-color: lightgray;
    }

    QAbstractItemView::indicator {
    background-color: rgb(0, 255, 0);
    width :20;
    height :20;
    }
    QAbstractItemView::indicator:checked {
    background-color: rgb(255, 170, 0);
    }