1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:48:12 +00:00

LibGUI: Allow bypassing hook when setting SpinBox range

Pass false to set_range to avoid on_change side-effects.
This commit is contained in:
thankyouverycool 2021-04-22 13:29:22 -04:00 committed by Andreas Kling
parent f90c224fc5
commit 99e7ad4b76
2 changed files with 3 additions and 3 deletions

View file

@ -63,7 +63,7 @@ void SpinBox::set_value(int value)
on_change(value);
}
void SpinBox::set_range(int min, int max)
void SpinBox::set_range(int min, int max, bool change)
{
VERIFY(min <= max);
if (m_min == min && m_max == max)
@ -76,7 +76,7 @@ void SpinBox::set_range(int min, int max)
m_value = clamp(m_value, m_min, m_max);
if (m_value != old_value) {
m_editor->set_text(String::number(m_value));
if (on_change)
if (change && on_change)
on_change(m_value);
}