问题
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