Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juangburgos/qfunctionutils
Qt helper functions for callback execution, throttle, debounce, etc.
https://github.com/juangburgos/qfunctionutils
cplusplus cplusplus-11 cpp cpp11 qt qt5
Last synced: 4 months ago
JSON representation
Qt helper functions for callback execution, throttle, debounce, etc.
- Host: GitHub
- URL: https://github.com/juangburgos/qfunctionutils
- Owner: juangburgos
- License: mit
- Created: 2019-09-02T08:25:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-11T21:42:25.000Z (about 5 years ago)
- Last Synced: 2024-10-12T16:22:59.385Z (4 months ago)
- Topics: cplusplus, cplusplus-11, cpp, cpp11, qt, qt5
- Language: C++
- Size: 4.88 KB
- Stars: 13
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# QFunctionUtils
Provides the following helper functions:
* `QFunctionUtils::Debounce` :
Receives a callback as first argument and a delay time in miliseconds as a second argument.
Returns an `std::function` with the same signature as the given callback. The returned function
can be called any number of times wihtin the given delay time, but will only execute the
given callback once the delay time has passed, and the function has not been called in this
period.This is useful in situations when it is desired to execute a command every so often. For example
when a user clicks a button many times within a short period of time, but the logic behind takes
some time to execute, so it is desired to ignore the multiple clicks and execute the logic
only once. But if the delay time period passes, then the user can issue the command once again.* `QFunctionUtils::Throttle` :
Same as `Debounce`, but it also executes the command once at the beginning, then waits for the
delay time period (ignoring any other of the calls) and then execute it once again at the end
of the delay time period.