Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Getting Coordinates for Cells in QTableview of other cells in delegate's paint function.



  • Note, I'm not asking about the current cell. I'm asking about getting some OTHER cell's position by row and column.

    I've set a delegate for my Qtableview to handle graphics.

    Inside my paint(self,painter:QPainter, option, index:QModelIndex): I know that I can access that current cell's location using option.rect.

    I'm looking to get the rect in ANOTHER cell.

    I know I can get the other cell's index using index.model().index(anotherR,anotherC) but I don't know how to get the 'option'(QstyleOptionViewItem) for that other cell.

    Thank you so much.

    I've been through the Qt documentation on these classes but couldn't find any leads.

    I'm using Pyqt5 is that matters.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you explain your use case ? It's pretty unusual to get the rectangle of a different cell for painting with a delegate.


Log in to reply