mirror of
https://github.com/RGBCube/serenity
synced 2025-06-19 04:12:07 +00:00
AK: Add String::number() for creating a String from a number.
Instead of manually doing String::format("%d"/"%u") everywhere, let's have a String API for this. It's just a wrapper around format() for now, but it could be made more efficient in the future.
This commit is contained in:
parent
8ac2b30de7
commit
b79112e6d6
11 changed files with 26 additions and 14 deletions
|
@ -13,7 +13,7 @@ GSpinBox::GSpinBox(GWidget* parent)
|
|||
if (ok)
|
||||
set_value(value);
|
||||
else
|
||||
m_editor->set_text(String::format("%d", m_value));
|
||||
m_editor->set_text(String::number(m_value));
|
||||
};
|
||||
m_increment_button = new GButton(this);
|
||||
m_increment_button->set_focusable(false);
|
||||
|
@ -38,7 +38,7 @@ void GSpinBox::set_value(int value)
|
|||
if (m_value == value)
|
||||
return;
|
||||
m_value = value;
|
||||
m_editor->set_text(String::format("%d", value));
|
||||
m_editor->set_text(String::number(value));
|
||||
update();
|
||||
if (on_change)
|
||||
on_change(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue