How to add text-decoration under the text in a QTreeWidgetItem?



  • Just like below,

    I have a QTreeWidget, and I want set the text-decoration: underline like css in a QTreeWidgetItem when I hover over it, but qss don't suport the text-decoration, can someone give me any advice?



  • In the same slot in which you change the cursor call

    QFont oldFont = treeItem->data(0,Qt::FontRole).value<QFont>();
    oldFont.setUnderline(!oldFont.underline());
    treeItem->setData(0,Qt::FontRole,oldFont);
    


  • @VRonin Thanks a lot ,, successed.


Log in to reply
 

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