Quote Originally Posted by Davor View Post
Furthermore, I don't see what's wrong with covering a widget with other widgets, as long as they remain in the hierarchy.
If you do it in paintEvent() then it's terribly wrong. If not then it's still more logical to hide the header first and then replace it with something of your own.

Furthermore, the header isn't painting anything. A better way to do it would be to put them on the viewport:
Qt Code:
  1. headerSections.insert(i,new HeaderObject(this.viewport()))
To copy to clipboard, switch view to plain text mode 
No. The header is above the viewport, not inside it.

The paintSection() should arrange all the widgets on the viewport, and they would be in sync all the time with the columns. So basicly, it only paints once, when new columns are added. Other times, it just checks whether widget is in the correct position.
I think at least one of us doesn't understand how repainting widget in Qt works and what does QWidget::show() do. In essence it does something different that QWidget::render()
For one, that's a lot of work for something that is already there,
Not really. QHeaderView is a very stupid class, it's very easy to replace it.

which is (between other things) keeping the header columns in sync with the rest.
That's very easy. All the required signals are already there.

For two, doesn't the Object oriented paradigm say to reuse the items, instead of to hide them? QHeaderView is there, like it or not.
The thing is it is mostly a stub, not a real class. And you are not using the header view if you just put a widget over it.