I want to have have the list separated by lines, later I might need to add a second column. I did not like the idea of reimplementing the table widget/view painter... plus, I would like to learn how to reuse the painter of other widgets
I want to have have the list separated by lines, later I might need to add a second column. I did not like the idea of reimplementing the table widget/view painter... plus, I would like to learn how to reuse the painter of other widgets
Thanks for the help, I realize I did not make a clear question :-(
That was not my intention. Although I do that in my example, actually I defined one static QTableWidget instance inside the constructor of my item delegate. I rewrote that part within the paint() function of the question to make it less cluttered with code.
That is what I want. For drawing a table within a cell I must align the text and draw lines for the grid. I expected that if the QTableView/QTableWidget have a painter doing what I want, there should be a way to reuse it.
Somehow I suppose I can give them the QPainter I receive from one of the parameters and let them do the drawing for me.
I could also make the question more generic. I have a table with a custom item delegate and I want this delegate to draw tables within some of the cells. I thought that painting myself was the way to go![]()
But you still have to repopulate the widget each time you paint a cell.
I think you misinterpret what "painter" is.That is what I want. For drawing a table within a cell I must align the text and draw lines for the grid. I expected that if the QTableView/QTableWidget have a painter doing what I want, there should be a way to reuse it.
Bookmarks