0

I am trying to disable the remaining item text underline that shows up when deselecting an item from a QTreeWidget.

setFocusPolity(Qt::NoFocus);

does what I need but it disables keyboard arrow navigation which is something I want to have.

I haven't found what property I need to disable in the StyleSheet. I have been messing around with

setStyleSheet(QTreeview::item:focus:!selected {...});

Any Idea? Thank you.

Ony10
  • 3
  • 3
  • There is no text underline when an item is deselected in QTreeWidget for me. I'm testing with both Qt5 and Qt6 in Windows 10. Can you elaborate with some pictures perhaps – Minh Jan 17 '22 at 14:54
  • Can you attach a picture... ? – Dariusz Jan 17 '22 at 17:36
  • Does this answer your question? https://stackoverflow.com/questions/15830383/get-rid-of-qts-dotted-outline-on-qlistview-items – Minh Jan 17 '22 at 20:39
  • You don't want to mess with focus policy in this case, can you try with simple `QListWidget::item{...}` and `QListWidget::item:selected{...}` ? – Mat Jan 18 '22 at 06:56
  • I am sorry it's not possible to attach an image. I am using Qt 4.8.7 (old version). It's a black line with a gradient that indicates what column in a row was selected. Also I'm on Linux Centos (MATE). Setting the QTreeView::item {color: red} for example makes this line also red... which means is part of the font? This line is also there when an item is selected but it's white (over the green highlighted item). – Ony10 Jan 18 '22 at 09:36

0 Answers0