From 495768517ff6d4f82439dfbdb3d25b0667068154 Mon Sep 17 00:00:00 2001 From: Lucas Meurer Date: Mon, 31 Aug 2026 14:25:52 +0200 Subject: [PATCH] Mark the widgets a `DragValue` is built from with `DragValue::CLASS` A drag value is not a widget of its own: it shows a `Button` while you drag it and a `TextEdit` while you type into it. A `StyleProvider` asked to style either had no way to tell it apart from a stand-alone one, so it could not style the two states as one control. Set `egui::drag_value` on the drag value itself; it already forwards its classes to both. Co-Authored-By: Claude Opus 5 (1M context) --- crates/egui/src/widgets/drag_value.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/egui/src/widgets/drag_value.rs b/crates/egui/src/widgets/drag_value.rs index d55676987..d84cb02f3 100644 --- a/crates/egui/src/widgets/drag_value.rs +++ b/crates/egui/src/widgets/drag_value.rs @@ -71,6 +71,9 @@ pub struct DragValue<'a> { impl<'a> DragValue<'a> { const ATOM_ID: &'static str = "drag_item"; + /// Present on the [`Button`] and the [`TextEdit`] a drag value is built from. + pub const CLASS: &'static str = "egui::drag_value"; + pub fn new(value: &'a mut Num) -> Self { let slf = Self::from_get_set(move |v: Option| { if let Some(v) = v { @@ -100,7 +103,7 @@ impl<'a> DragValue<'a> { custom_formatter: None, custom_parser: None, update_while_editing: true, - classes: Classes::default(), + classes: Classes::default().with_class(Self::CLASS), min_size: None, } }