31 using Callback = std::function<void ()>;
40 std::chrono::milliseconds delay,
42 QObject * parent =
nullptr);
66 [[nodiscard]] std::chrono::milliseconds
get_delay ()
const;
79 void execute_pending ();
83 std::chrono::milliseconds delay_;
85 bool pending_{
false };
std::chrono::milliseconds get_delay() const
Get the current delay.
void set_delay(std::chrono::milliseconds delay)
Set the delay for future debounce operations.
void debounce()
Alternative method name for scheduling callback execution.
void operator()()
Call this to schedule the callback execution.
bool is_pending() const
Check if there's a pending callback execution.
Debouncer(std::chrono::milliseconds delay, Callback callback, QObject *parent=nullptr)
Construct a debouncer.
void cancel()
Cancel any pending callback execution.
A unique pointer for QObject objects that also works with QObject-based ownership.