I am trying to implement a similar Excel behavior in a QTableView, where the border is painted around the entire current selection. I tried this, which seems like a hundred different ways and more and more problems arise. I can draw the border quite easily, but the remnants of the border are left whenever the choice changes. Here is one example I tried in QTableView :: paintEvent ...
void MyTableView::paintEvent(QPaintEvent* event) {
This code produces results like this
I like any suggestions on how to make this run smoother. I tried to do this in the delegate, but then the delegate must know all the selected indexes and cannot draw the grid lines drawn by QTableView. Also, my table class needs to know where the border was drawn.
source share