I don't want rows to be highlighted on mouse hover. How to disable this highlighting?
Either remove highlighting at all or change it's color: both solutions are fine.
I don't want rows to be highlighted on mouse hover. How to disable this highlighting?
Either remove highlighting at all or change it's color: both solutions are fine.
You can do it the Delegate way:
#include <QStyledItemDelegate>
class NoHighlightDelegate:public QStyledItemDelegate{
public:
void initStyleOption(QStyleOptionViewItem*option,const QModelIndex&viewIndex)const override{
QStyledItemDelegate::initStyleOption(option,viewIndex);
option->state&=~QStyle::State_MouseOver;}
};
Then set this Delegate to your QTreeView
:
//QTreeView*view;
auto*delegate=new NoHighlightDelegate();
delegate->setParent(view);
view->setItemDelegate(delegate);
And you will not get into the hidden selected line problem.