QTableView 如何突出显示鼠标悬停的整行?

问题描述:

选择行为设置为选择行,但仅突出显示悬停的单元格.有没有办法突出显示整行?

The selection behavior is set to select rows, but only the hovered cell is highlighted. Is there any way to highlight the entire row?

有两种方式..

1) 您可以使用委托来绘制行背景...
您需要将行设置为在委托中突出显示,并以此为基础,做突出显示.

1) You can use delegates to draw the row background...
You will need to set the row to highlight in the delegate and based on that, do the highlighting.

2) 捕捉当前行的信号.迭代该行中的项目和为每个项目设置背景.

2) Catch the signal of current row. Iterate over the items in that row and set background for each item.

希望对你们有用.