Override paintEvent or paintSection in QHeaderView
-
Hello again,
I am trying to rewrite QHeaderView to get individual colors for sections (depending on the values in the column), QPixmaps in them and so on...
The CHeaderView class (the derived from QHeaderView) uses the same model like the QTableView. So in general I know I need to use the model in the CHeaderView to get this job done... :-)
My problem is that I dont know where I could use it.
Some google results indicate that I need to do that in the paintEvent-Method, but I am missing the logicalIndex there. So how should I know which section is the actual one who is repainted?Furthermore there is the method paintSection (with logicalIndex), but I cant figure out when it is called. How can I figure that out (in debug mode I never get there)? Do I have to call the method manually?
Thank you!
-
Hi,
The most simple to see when it's called is to look at the documentation.
It's called in the paintEvent of QHeaderView. There might be other places. You can use the browser to look for them.
You can also check the base implementation to see how things are done.
-
@firen said in Override paintEvent or paintSection in QHeaderView:
i am wondering that I am not able to write in the forum with firefox
I use Firefox, no problem.
What happens if you use Firefox and what version is it?