QListWidget: How to disable when mouse hover ,the items change background color?
-
@brucezcg Here's 2 different ways to do it.. One with CSS (the easy way) and the other with a custom paint (the hard way).
https://stackoverflow.com/questions/16016644/deactivated-qlistwidgetitem-hover
https://stackoverflow.com/questions/42403175/qlistwidget-disable-mouseover-highlight
-
-
Then QStyledItemDelegate it is.
-
@brucezcg said in QListWidget: How to disable when mouse hover ,the items change background color?:
I don't want to change background color when hover,
I just want to disable hover, when hover, the items stay the background color, may be different colors, so I couldn't set
hover to certain color.Well in that post I linked you on stackoverflow, it shows:
QListWidget::item:hover, QListWidget::item:disabled:hover, QListWidget::item:hover:!active, {background: transparent;}
That means it just hides the hover, doesn't set it to a certain color. It should do exactly what you need.
You can of course make a custom delegate too. That's more work that setting a quick css though.