QTableView 如何突出显示鼠标悬停的整行? [英] QTableView How can I highlight the entire row for mouse hover?

查看:98
本文介绍了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.

希望对你们有用.

这篇关于QTableView 如何突出显示鼠标悬停的整行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆