mirror of
https://github.com/RGBCube/serenity
synced 2025-07-07 15:57:35 +00:00
GTableView: Headers were not usable when the view was scrolled.
This commit is contained in:
parent
613c7b9856
commit
d643daebb2
1 changed files with 15 additions and 17 deletions
|
@ -108,13 +108,12 @@ void GTableView::mousedown_event(GMouseEvent& event)
|
||||||
if (!model())
|
if (!model())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto adjusted_position = this->adjusted_position(event.position());
|
|
||||||
|
|
||||||
if (event.y() < header_height()) {
|
|
||||||
if (event.button() != GMouseButton::Left)
|
if (event.button() != GMouseButton::Left)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (event.y() < header_height()) {
|
||||||
for (int i = 0; i < model()->column_count(); ++i) {
|
for (int i = 0; i < model()->column_count(); ++i) {
|
||||||
if (column_resize_grabbable_rect(i).contains(adjusted_position)) {
|
if (column_resize_grabbable_rect(i).contains(event.position())) {
|
||||||
m_resizing_column = i;
|
m_resizing_column = i;
|
||||||
m_in_column_resize = true;
|
m_in_column_resize = true;
|
||||||
m_column_resize_original_width = column_width(i);
|
m_column_resize_original_width = column_width(i);
|
||||||
|
@ -122,7 +121,7 @@ void GTableView::mousedown_event(GMouseEvent& event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto header_rect = this->header_rect(i);
|
auto header_rect = this->header_rect(i);
|
||||||
if (header_rect.contains(adjusted_position)) {
|
if (header_rect.contains(event.position())) {
|
||||||
auto new_sort_order = GSortOrder::Ascending;
|
auto new_sort_order = GSortOrder::Ascending;
|
||||||
if (model()->key_column() == i)
|
if (model()->key_column() == i)
|
||||||
new_sort_order = model()->sort_order() == GSortOrder::Ascending
|
new_sort_order = model()->sort_order() == GSortOrder::Ascending
|
||||||
|
@ -135,7 +134,7 @@ void GTableView::mousedown_event(GMouseEvent& event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.button() == GMouseButton::Left) {
|
auto adjusted_position = this->adjusted_position(event.position());
|
||||||
for (int row = 0, row_count = model()->row_count(); row < row_count; ++row) {
|
for (int row = 0, row_count = model()->row_count(); row < row_count; ++row) {
|
||||||
if (!row_rect(row).contains(adjusted_position))
|
if (!row_rect(row).contains(adjusted_position))
|
||||||
continue;
|
continue;
|
||||||
|
@ -149,7 +148,6 @@ void GTableView::mousedown_event(GMouseEvent& event)
|
||||||
}
|
}
|
||||||
model()->set_selected_index({ });
|
model()->set_selected_index({ });
|
||||||
update();
|
update();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTableView::mousemove_event(GMouseEvent& event)
|
void GTableView::mousemove_event(GMouseEvent& event)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue