Subclassing
When subclassing QItemDelegate to create a delegate that displays items using a custom renderer, it is important to ensure that the delegate can render items suitably for all the required states; e.g. selected, disabled, checked. The documentation for the paint() function contains some hints to show how this can be achieved.
委托的一个作用就是:显示item。
那么paint()函数是必须的,因为,自定义委托,必须要绘制出item的数据。也就是显示出来。