mirror of
https://github.com/RGBCube/serenity
synced 2025-06-19 17:52:07 +00:00
GTableView: Don't include hidden columns in content width.
This commit is contained in:
parent
b54eefa25e
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 content_width = 0;
|
||||||
int column_count = model()->column_count();
|
int column_count = model()->column_count();
|
||||||
for (int i = 0; i < column_count; ++i)
|
for (int i = 0; i < column_count; ++i) {
|
||||||
content_width += column_width(i) + horizontal_padding() * 2;
|
if (!is_column_hidden(i))
|
||||||
|
content_width += column_width(i) + horizontal_padding() * 2;
|
||||||
|
}
|
||||||
int content_height = item_count() * item_height();
|
int content_height = item_count() * item_height();
|
||||||
|
|
||||||
set_content_size({ content_width, content_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) {
|
for (int column = 0; column < model()->column_count(); ++column) {
|
||||||
auto& column_data = this->column_data(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());
|
action.set_checked(!action.is_checked());
|
||||||
set_column_hidden(column, !action.is_checked());
|
set_column_hidden(column, !action.is_checked());
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue