LibGUI: Only repaint the affected indices on AbstractView item hover

Previously, moving the cursor over items in an item view would cause it
to repaint itself completely. Now we only repaint the two affected
items (the old hovered item and the new hovered item.)
This commit is contained in:
Andreas Kling 2021-07-10 17:12:45 +02:00
commit b368560800
Notes: sideshowbarker 2024-07-18 09:24:58 +09:00

View file

@ -249,7 +249,12 @@ void AbstractView::set_hovered_index(const ModelIndex& index)
auto old_index = m_hovered_index;
m_hovered_index = index;
did_change_hovered_index(old_index, index);
update();
if (old_index.is_valid())
update(to_widget_rect(paint_invalidation_rect(old_index)));
if (index.is_valid())
update(to_widget_rect(paint_invalidation_rect(index)));
}
void AbstractView::leave_event(Core::Event& event)