1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Fix: assign a different id to each table cell, avoiding id clashes (#4076)

Each cell in a table now has a `Ui` with a unique `Id` based on the row
and column.

This avoids Id-clashes, e.g. when putting a `CollapsingHeader` in a
table cell.
This commit is contained in:
Emil Ernerfeldt
2024-02-20 13:35:19 +01:00
committed by GitHub
parent 68b3ef7f6b
commit a33ae64785
3 changed files with 21 additions and 5 deletions

View File

@@ -1166,7 +1166,13 @@ impl<'a, 'b> TableRow<'a, 'b> {
selected: self.selected,
};
let (used_rect, response) = self.layout.add(flags, width, height, add_cell_contents);
let (used_rect, response) = self.layout.add(
flags,
width,
height,
egui::Id::new((self.row_index, col_index)),
add_cell_contents,
);
if let Some(max_w) = self.max_used_widths.get_mut(col_index) {
*max_w = max_w.max(used_rect.width());