Highlight specific substrings in a QTreeView

左心房为你撑大大i 提交于 2019-12-23 01:06:34

问题


I want to highlight (or in general customise the formatting) of specific substrings appearing in a QTreeView in PyQt. To demonstrate what I mean, I have taken the example at PyQt4\examples\itemviews\dirview.pyw and manually added highlighting:

Here all instances of the substring 'as' are highlighted, but in general it might not be a pattern match, I may actually want to be very specific.

I know that this can be easily done to a QTextEdit as per this SO question, but that relied on moving around the textCursor which I don't believe exists for a QTreeView.

Can this be easily done?

来源:https://stackoverflow.com/questions/23625069/highlight-specific-substrings-in-a-qtreeview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!