Rerectangle around a single row in QTableWidget
What is the best way to draw a rectangle around a single row in QTableWidget? All searches lead me to QTableView and delegates. My main problem is that I am not able to find the geometry of the area to draw. I have tried obtaining the geometry of the cell widgets, thus:
int x = m_pTableWidget->cellWidget(0,i)->width();
but that down not work.
Hi and welcome to devnet,
In what conditions do you want to draw that rectangle ?
@SGaist I want to draw a rectangle around the top row and it should be there permanently. So I can do it in the constructor.
Maybe you can reuse my test delegate from
Row number 0 or the one that is currently show the closest to the header ? If the later then QRubberBand might also be of interest.
@SGaist Yes, it is. The problem I have is that I cannot find the rectangle I want to draw around. I looked at
mrjj 's solution above, but that seems to involve a delegate. What is the "option" in:
const QRect rect( option.rect );