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.
No. The header is above the viewport, not inside it.Furthermore, the header isn't painting anything. A better way to do it would be to put them on the viewport:
Qt Code:
headerSections.insert(i,new HeaderObject(this.viewport()))To copy to clipboard, switch view to plain text mode
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()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.
Not really. QHeaderView is a very stupid class, it's very easy to replace it.For one, that's a lot of work for something that is already there,
That's very easy. All the required signals are already there.which is (between other things) keeping the header columns in sync with the rest.
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.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.
Bookmarks