Important: Please read the Qt Code of Conduct -

QItemDelegate::paint() - paint row based on criteria from single cell

  • Hi

    I'm just about done migrating a project from QTableWidget to QTableView. The last bit has to do with painting each row. Generally I will look for several user-entered criteria. Out of 10 columns, perhaps the data in column 8 return true, and I need the background of the entire row painted red.

    I've reimplimented QItemDelegate::paint() successfully, but it is called for each cell, not for each row.

    If I understand the model/view concept correctly, in a case such as above, I'm going to have to keep track of what row should be what color, and then re-request an update for each cell in that row? I've got kind of a scrolling thing going. Imagine a bunch of ping messages from different nodes coming in, where each new one is placed on top.

    Still trying to wrap my head around this after working w/ QTableWidget for so long.

Log in to reply