how to set the color of 1 colum of the QTreeWidgetItem?



  • how to set the color of 1 colum of the QTreeWidgetItem?
    background color, and border-color



  • @opengpu2 said in how to set the color of 1 colum of the QTreeWidgetItem?:

    background color

    item->setData(column,Qt::BackgroundRole,colour);

    border-color

    I don't think QTreeView has borders by default, you'll probably need to save the colour in a user role (item->setData(column,Qt::UserRole,colour);) and then reimplement paint() an a custom QStyledItemDelegate that you then apply on the widget


Log in to reply
 

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