mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 09:18:52 +00:00
LibGUI: Minor tidying.
This commit is contained in:
parent
46caa2663b
commit
7d2c962836
Notes:
sideshowbarker
2024-07-19 15:06:46 +09:00
Author: https://github.com/awesomekling
Commit: 7d2c962836
2 changed files with 5 additions and 8 deletions
|
@ -103,14 +103,15 @@ Rect GTableView::header_rect(int column_index) const
|
|||
void GTableView::mousedown_event(GMouseEvent& event)
|
||||
{
|
||||
if (event.y() < header_height()) {
|
||||
// FIXME: Do something when clicking on a header.
|
||||
auto adjusted_position = event.position().translated(m_horizontal_scrollbar->value(), 0);
|
||||
for (int i = 0; i < m_model->column_count(); ++i) {
|
||||
auto header_rect = this->header_rect(i);
|
||||
if (header_rect.contains(adjusted_position)) {
|
||||
auto new_sort_order = GSortOrder::Ascending;
|
||||
if (m_model->key_column() == i)
|
||||
new_sort_order = m_model->sort_order() == GSortOrder::Ascending ? GSortOrder::Descending : GSortOrder::Ascending;
|
||||
new_sort_order = m_model->sort_order() == GSortOrder::Ascending
|
||||
? GSortOrder::Descending
|
||||
: GSortOrder::Ascending;
|
||||
m_model->set_key_column_and_sort_order(i, new_sort_order);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue