You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a few widget pages that control different parts of my app. I want to call through to Rust code that accepts the widgets' content batch-wise (always a whole "page"), after user actions subsided for a short duration in that context. This means I must constantly restart a timer on user action, and only call through to Rust in the Timer's triggered callback.
With the Timer pseudo-element's current state, I have to use this workaround:
Qt's QTimer's start() restarts the timer, if it was already started.
It's for measuring time, but .NET's Stopwatch class has a Restart() method.
I think restart() would be more unambiguous than start() for a function that restarts, if already started.
Further considerations:
The convenience function stop() would also be worth considering to make your code more expressive than with timer.running = false;.
Also, a oneshot convenience boolean property on Timer could be seen as fitting for this use case, making Slint run timer.running = false; after it called the Timer's triggered callback.
A prepone() function would also be very useful and code-simplifying for this use case, because in my GUI, the widget page identity changing, because another list entry was chosen, requires immediate acceptance of the page's current state, before it'll be filled with other data. Whether the page needs to be accepted at all depends on whether Timer's new restart() function was called before. If it wasn't, meaning the Timer isn't running, prepone() would just need to be a no-op.
The text was updated successfully, but these errors were encountered:
BTW, if setting interval to a value that only differs by a millisecond restarts the timer, it should also be restarted, if it's set to the same value. If that's technically not possible, the behavior in this regard should be clearly documented.
If this isn't technically possible, there should probably also be a general-purpose method for setting the interval that always restarts. Qt's QTimer has two overloads of its start() method, one parameterless, one with the new interval to be used. So, the new restart() method this issue proposes should also exist with an additional overload (if technically possible) or with a name like restart-with-interval().
I vaguely remember discussing restart() with @ogoffart but I think we said we'd leave it out for now. The Rust API has it, so ... it's probably more of a question of "do we want this?".
I have a few widget pages that control different parts of my app. I want to call through to Rust code that accepts the widgets' content batch-wise (always a whole "page"), after user actions subsided for a short duration in that context. This means I must constantly restart a timer on user action, and only call through to Rust in the
Timer
'striggered
callback.With the
Timer
pseudo-element's current state, I have to use this workaround:Timer
should provide arestart()
function that starts or restarts the timer for you, without the need to tamper with theinterval
.Precedential cases:
Timer
has arestart()
method.QTimer
'sstart()
restarts the timer, if it was already started.Stopwatch
class has aRestart()
method.I think
restart()
would be more unambiguous thanstart()
for a function that restarts, if already started.Further considerations:
stop()
would also be worth considering to make your code more expressive than withtimer.running = false;
.oneshot
convenience boolean property onTimer
could be seen as fitting for this use case, making Slint runtimer.running = false;
after it called theTimer
'striggered
callback.prepone()
function would also be very useful and code-simplifying for this use case, because in my GUI, the widget page identity changing, because another list entry was chosen, requires immediate acceptance of the page's current state, before it'll be filled with other data. Whether the page needs to be accepted at all depends on whetherTimer
's newrestart()
function was called before. If it wasn't, meaning theTimer
isn't running,prepone()
would just need to be a no-op.The text was updated successfully, but these errors were encountered: