mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
GTableView: Don't include hidden columns in content width.
This commit is contained in:
parent
b54eefa25e
commit
dd7406ce3f
Notes:
sideshowbarker
2024-07-19 14:10:32 +09:00
Author: https://github.com/awesomekling
Commit: dd7406ce3f
1 changed files with 6 additions and 3 deletions
|
@ -28,8 +28,10 @@ void GTableView::update_content_size()
|
|||
|
||||
int content_width = 0;
|
||||
int column_count = model()->column_count();
|
||||
for (int i = 0; i < column_count; ++i)
|
||||
content_width += column_width(i) + horizontal_padding() * 2;
|
||||
for (int i = 0; i < column_count; ++i) {
|
||||
if (!is_column_hidden(i))
|
||||
content_width += column_width(i) + horizontal_padding() * 2;
|
||||
}
|
||||
int content_height = item_count() * item_height();
|
||||
|
||||
set_content_size({ content_width, content_height });
|
||||
|
@ -423,7 +425,8 @@ GMenu& GTableView::ensure_header_context_menu()
|
|||
|
||||
for (int column = 0; column < model()->column_count(); ++column) {
|
||||
auto& column_data = this->column_data(column);
|
||||
column_data.visibility_action = GAction::create(model()->column_name(column), [this, column] (GAction& action) {
|
||||
auto name = model()->column_name(column);
|
||||
column_data.visibility_action = GAction::create(name, [this, column] (GAction& action) {
|
||||
action.set_checked(!action.is_checked());
|
||||
set_column_hidden(column, !action.is_checked());
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue