Qt QTableView draw border around active cells
I'm trying to implement behavior similar Excel in a QTableView, where a border is painted around the entire current selection. I have tried this what feels like a hundred different ways and keep getting problems. I can draw the border easily enough, but remnants of the border are left whenever the selection changes. Here is one example I've tried in QTableView::paintEvent ... void MyTableView::paintEvent(QPaintEvent* event) { // call QTableView's paint event first so we can draw over it QTableView::paintEvent(event); // activeSelection is a list of indexes that is updated in another function /