Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update spin value periodically if left mouse pressed is been holding #137

Closed
wants to merge 2 commits into from

Conversation

Kvaz1r
Copy link
Contributor

@Kvaz1r Kvaz1r commented Jul 18, 2020

I'm not sure that Timer::scheduleCallback is the right choice here, but idea is simple - move changing value from mouse release handler to mouse pressed handler and to call changer periodically while some conditions (mouse still pressed, mouse still hover on widget and correct spin button and there wasn't any new clicks) are still being true.

@texus
Copy link
Owner

texus commented Jul 19, 2020

I like the idea of using Timer::scheduleCallback.
Although it is unlikely to happen, I fear that it could cause issues if the widget is destroyed between scheduling the callback and receiving it. Instead of capturing this in the labmda, it would probably be better to capture something like spinButton=shared_from_this() and add spinButton-> in front of variables and functions inside the lambda. That way the widget can't be destroyed until after the scheduled lambda has been executed.

@Kvaz1r
Copy link
Contributor Author

Kvaz1r commented Jul 19, 2020

Fixed

@texus
Copy link
Owner

texus commented Jul 19, 2020

Manually merged as 8e8db09

@texus texus closed this Jul 19, 2020
@Kvaz1r Kvaz1r deleted the Spinbuttonholding branch July 19, 2020 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants