Search code examples
c++qtsignalsqtreewidget

Is it possible to disable the light-blue mouse over highlighting on a QTreeWidgetItem?


I've a QTreeWidget and need to disable the mouse over highlighting on the childItems but not the click selection. The point here is, that I need to set this per Item because some are selectable. I was thinking about the QTreeWidget::itemEntered signal to check if the item should be highlighted or not but I can't get it to work because the description says

QTreeWidget mouse tracking needs to be enabled for this feature to work.

and I can't figure out how.

So my questions for are: How can I enable mouse tracking?

Is there an easier way to disable the highlighting?


Solution

  • Simply invoke setMouseTracking() to enable mouse tracking for a specific widget.