-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
egui_extras: table cell dividers #4783
Comments
Turns out this is (kinda) possible using Frame::none().stroke(Stroke::new(2.0, Rgba::from_black_alpha(1.0))).show(ui, |ui| {
// whatever here...
}) |
You can also draw the lines manually with |
Yeah, more controllable styles would be really nice especially for things like Tables and Grids. #3284 seems to be getting onto that though. |
I made these utilities just to make it a bit faster for me to write: fn draw_hlines<R>(ui: &mut Ui, length: f32, next: impl FnOnce(&mut Ui) -> R) {
ui.painter().hline(0.0..=length, 0.0, PathStroke::new(2.0, Rgba::from_rgb(0.0, 0.0, 0.0)));
next(ui);
ui.painter().hline(0.0..=length, ui.min_rect().height() + 2.0, PathStroke::new(2.0, Rgba::from_rgb(0.0, 0.0, 0.0)));
}
fn draw_vlines<R>(ui: &mut Ui, height: f32, next: impl FnOnce(&mut Ui) -> R) {
ui.painter().vline(0.0, 0.0..=height, PathStroke::new(2.0, Rgba::from_rgb(0.0, 0.0, 0.0)));
next(ui);
ui.painter().vline(ui.min_rect().width() + 2.0, 0.0..=height, PathStroke::new(2.0, Rgba::from_rgb(0.0, 0.0, 0.0)));
}
fn draw_box<R>(ui: &mut Ui, length: f32, height: f32, next: impl FnOnce(&mut Ui) -> R) {
draw_hlines(ui, length, |ui| draw_vlines(ui, height, next))
} Calling it in the header (column initialization) callbacks results in nothing happening. |
Is your feature request related to a problem? Please describe. Kinda. I want to make cell dividers but adding separators makes the text literally disappear, which is a problem on its own.
Describe the solution you'd like
I want the ability to add cell dividers (both between rows and columns) and a border around the edge of the table. All of which should be customizable by color and size in pixels.
Describe alternatives you've considered
I tried using separators (e.g.,
ui.add(Separator::default().vertical());
on both sides of the label in each row/column) which made the text disappear.I haven't seen any issues for this so I'm making this one
The text was updated successfully, but these errors were encountered: