mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 11:20:03 +00:00
LibGUI: Display hidden columns as hidden
Until now, hidden columns were displayed as visible in the context menu. An easy way to reproduce this is: - Open the TextEditor - Ctrl-O to open the file selector - Switch to table view - Right-click the header Expected behavior: Hidden columns like 'Owner' and 'Group' should not have a checkmark, because they are hidden. Actual behavior: They did have a checkmark. Clicking on it to 'hide' the already hidden column removed the checkmark, but was a no-op to the table view. This commit fixes this behavior, by correctly initializing the context menu, and properly updating the context menu if external code calls 'set_column_hidden' later.
This commit is contained in:
committed by
Andreas Kling
parent
55ff392835
commit
ebabce30bd
@@ -184,6 +184,9 @@ void AbstractTableView::set_column_hidden(int column, bool hidden)
|
||||
if (column_data.visibility == !hidden)
|
||||
return;
|
||||
column_data.visibility = !hidden;
|
||||
if (column_data.visibility_action) {
|
||||
column_data.visibility_action->set_checked(!hidden);
|
||||
}
|
||||
update_content_size();
|
||||
update();
|
||||
}
|
||||
@@ -202,7 +205,7 @@ Menu& AbstractTableView::ensure_header_context_menu()
|
||||
column_data.visibility_action = Action::create_checkable(name, [this, column](auto& action) {
|
||||
set_column_hidden(column, !action.is_checked());
|
||||
});
|
||||
column_data.visibility_action->set_checked(true);
|
||||
column_data.visibility_action->set_checked(column_data.visibility);
|
||||
|
||||
m_header_context_menu->add_action(*column_data.visibility_action);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user