mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibGUI: Select the edited text by default in StringModelEditingDelegate
This way, if you press F2 to edit the name of an item, the name will be selected in the editor that pops up, and you can start typing a new name for it immediately.
This commit is contained in:
parent
f294bdedcc
commit
76239f89c2
Notes:
sideshowbarker
2024-07-19 00:33:21 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/76239f89c21
1 changed files with 6 additions and 1 deletions
|
@ -96,7 +96,12 @@ public:
|
|||
return textbox;
|
||||
}
|
||||
virtual Variant value() const override { return static_cast<const TextBox*>(widget())->text(); }
|
||||
virtual void set_value(const Variant& value) override { static_cast<TextBox*>(widget())->set_text(value.to_string()); }
|
||||
virtual void set_value(const Variant& value) override
|
||||
{
|
||||
auto& textbox = static_cast<TextBox&>(*widget());
|
||||
textbox.set_text(value.to_string());
|
||||
textbox.select_all();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue