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

Add Visuals::striped as global default for Grids and Tables

This commit is contained in:
Emil Ernerfeldt
2022-12-13 21:02:39 +01:00
parent 51081d69fc
commit 126be51ac3
3 changed files with 25 additions and 8 deletions

View File

@@ -218,7 +218,7 @@ impl Default for TableScrollOptions {
pub struct TableBuilder<'a> {
ui: &'a mut Ui,
columns: Vec<Column>,
striped: bool,
striped: Option<bool>,
resizable: bool,
cell_layout: egui::Layout,
scroll_options: TableScrollOptions,
@@ -230,16 +230,18 @@ impl<'a> TableBuilder<'a> {
Self {
ui,
columns: Default::default(),
striped: false,
striped: None,
resizable: false,
cell_layout,
scroll_options: Default::default(),
}
}
/// Enable striped row background for improved readability (default: `false`)
/// Enable striped row background for improved readability.
///
/// Default is whatever is in [`egui::Visuals::striped`].
pub fn striped(mut self, striped: bool) -> Self {
self.striped = striped;
self.striped = Some(striped);
self
}
@@ -373,6 +375,8 @@ impl<'a> TableBuilder<'a> {
scroll_options,
} = self;
let striped = striped.unwrap_or(ui.visuals().striped);
let state_id = ui.id().with("__table_state");
let initial_widths =
@@ -431,6 +435,8 @@ impl<'a> TableBuilder<'a> {
scroll_options,
} = self;
let striped = striped.unwrap_or(ui.visuals().striped);
let state_id = ui.id().with("__table_state");
let initial_widths =