TableView cell coloring



  • What would be the best way to manage the coloring (background color and border color/style) of a particular cell? I would like to create the appearance of merged cells.



  • I haven't played with borders ever.

    QTableView has a setShowGrid(bool) method, but that won't help you unless you want to take rid of all borders. Some people do that, and then put some of them back on by using style sheets. As said I haven't ever toyed with that, but I doubt the result will be very good.

    I'd look into using a QStyledItemDelegate (or QSortFilterProxyModel) subclass with the QTableView.

    For the background, you can reimplement QStyledItemDelegate::data using the Qt::Background role. I am not too sure how to proceed about borders though. Sorry :(


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.