Quote Originally Posted by ugluk View Post
By default, QAbstractItemView derivatives all erase their backgrounds at every repaint event. But what, if the view is custom and the view's items themselves erase their backgrounds?
What if there are not enough items to cover all the view or some items have transparent background?

The view's erase is then superfluous. But if I do:

Qt Code:
  1. setAttribute(Qt::WA_NoSystemBackground);
To copy to clipboard, switch view to plain text mode 

on the view, the backgrounds of the view's scrollbars will not erase. Therefore, I wanted to erase their backgrounds "manually" (via fillRect()), while leaving the view's items to erase their own backgrounds.
Then set the attribute on the view's viewport and not on the view itself. However I don't think this optimalization is worth the effort you are putting into it.