summaryrefslogtreecommitdiff
path: root/LibGUI/GTableView.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-28 14:05:02 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-28 14:05:02 +0100
commit62b4f39cd43cc2c7ec0e2a1e8934df0a43aaffda (patch)
treee4c1329afe49b5a62c8127a2e1076dc2f3c96f2a /LibGUI/GTableView.cpp
parent6af2ce0f7ebb42fa280901887fb943c8060a1ce4 (diff)
downloadserenity-62b4f39cd43cc2c7ec0e2a1e8934df0a43aaffda.zip
LibGUI: GTableView should clear the selection if clicking outside items.
Diffstat (limited to 'LibGUI/GTableView.cpp')
-rw-r--r--LibGUI/GTableView.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/LibGUI/GTableView.cpp b/LibGUI/GTableView.cpp
index ca42ab23c3..f8f908bf5e 100644
--- a/LibGUI/GTableView.cpp
+++ b/LibGUI/GTableView.cpp
@@ -58,12 +58,15 @@ void GTableView::mousedown_event(GMouseEvent& event)
auto adjusted_position = event.position().translated(0, m_scrollbar->value());
if (event.button() == GMouseButton::Left) {
for (int i = 0; i < item_count(); ++i) {
- if (!row_rect(i).contains(adjusted_position))
- continue;
- m_model->set_selected_index({ i, 0 });
- update();
+ if (row_rect(i).contains(adjusted_position)) {
+ m_model->set_selected_index({ i, 0 });
+ update();
+ return;
+ }
}
}
+ m_model->set_selected_index({ });
+ update();
}
void GTableView::paint_event(GPaintEvent&)