[escher] Fix selection problem in SelectableTableView

Scenario that caused a problem: Go to Statistics, then "1", "Right",
"Right", "Right", OK. The cell does not draw itself as being edited, but
its right neighbour does.
This commit is contained in:
Léa Saviot
2018-11-07 14:51:43 +01:00
committed by Émilie Feral
parent c7635c5e4d
commit 56db3a484e

View File

@@ -78,6 +78,21 @@ bool SelectableTableView::selectCellAtLocation(int i, int j, bool setFirstRespon
selectColumn(i);
selectRow(j);
if (m_delegate) {
m_delegate->tableViewDidChangeSelection(this, previousX, previousY);
}
/* We need to scroll:
* - After notifying the delegate. For instance,
* StorageExpressionModelListController needs to update its memoized cell
* height values before any scroll.
* - Before setting the first responder. If the first responder is a view, it
* might change during the scroll. */
if (selectedRow() >= 0) {
scrollToCell(selectedColumn(), selectedRow());
}
HighlightCell * cell = selectedCell();
if (cell) {
// Update first responder
@@ -89,12 +104,7 @@ bool SelectableTableView::selectCellAtLocation(int i, int j, bool setFirstRespon
}
}
}
if (m_delegate) {
m_delegate->tableViewDidChangeSelection(this, previousX, previousY);
}
if (selectedRow() >= 0) {
scrollToCell(selectedColumn(), selectedRow());
}
cell = selectedCell();
if (cell) {
cell->setHighlighted(true);