Home > Mobile >  For the selected strings in qtableview draw the background color
For the selected strings in qtableview draw the background color

Time:09-30

I was using a QTableView QStringListModel, want to do a similar to notepad + +, selected after a word, all painted the background color on the same words,
Idea is to inherit QStyledItemDelegate, rewrite the paint method, using painter. FillRect background, reoccupy painter. DrawText draw string,
Now plans to use the find a search string, found after painting the background color, but the find returns the position of the string, not to draw the background color of the rectangular coordinates, could you tell me how can get the accurate coordinates, thank you!

CodePudding user response:

Use pyqt5
  •  Tags:  
  • Qt
  • Related