Coder Social home page Coder Social logo

alvazz / qfunctionutils Goto Github PK

View Code? Open in Web Editor NEW

This project forked from juangburgos/qfunctionutils

0.0 0.0 0.0 5 KB

Qt helper functions for callback execution, throttle, debounce, etc.

License: MIT License

C++ 98.18% Prolog 0.50% QMake 1.31%

qfunctionutils's Introduction

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.

qfunctionutils's People

Contributors

juangburgos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.