By default a QTreeWidget manages the selection of rows (when you click a row it highlights it, when you click another row it highlights that and deselects the previous row), I don’t want this and cant figure out how to turn it off.
By default a QTreeWidget manages the selection of rows ( when you click a
Share
you can use
setSelectionModeof theQAbstractItemViewclass (whichQTreeWidgetis inherited from) to set no selection mode to the component. Something like this (sorry, code in C++):In this case items would not get selected but you still will see focus rectangle around them. To fix this you can set your widget to not accept focus by calling:
if your tree widget has to accept focus but should not be drawing focus rectangles you can use custom item delegate and remove
State_HasFocusstate from the item’s state before drawing it. Something like this: