1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

Ladybird/Qt: Use a precise timer for event loop timer events

This improves the accuracy of `setTimeout()`.
This commit is contained in:
Tim Ledbetter 2024-02-26 17:52:03 +00:00 committed by Andrew Kaster
parent ee765e241e
commit a968bc6f80

View file

@ -91,6 +91,7 @@ static void qt_timer_fired(Core::TimerShouldFireWhenNotVisible should_fire_when_
intptr_t EventLoopManagerQt::register_timer(Core::EventReceiver& object, int milliseconds, bool should_reload, Core::TimerShouldFireWhenNotVisible should_fire_when_not_visible)
{
auto timer = new QTimer;
timer->setTimerType(Qt::PreciseTimer);
timer->setInterval(milliseconds);
timer->setSingleShot(!should_reload);
auto weak_object = object.make_weak_ptr();