Krita Source Code Documentation
Loading...
Searching...
No Matches
KisDeferredSignal Class Reference

This class is used for calling a specified callback function (which is a std::function) after a specified time delay. The callback is called from the QTimer event, so the usage of the class does not block the Qt's event loop. More...

#include <kis_deferred_signal.h>

+ Inheritance diagram for KisDeferredSignal:

Public Types

using CallbackFunction = std::function<void ()>
 

Static Public Member Functions

static void deferSignal (int delay, CallbackFunction function)
 

Private Slots

void timeout ()
 

Private Member Functions

 KisDeferredSignal (int delay, CallbackFunction function)
 

Private Attributes

CallbackFunction m_function
 

Detailed Description

This class is used for calling a specified callback function (which is a std::function) after a specified time delay. The callback is called from the QTimer event, so the usage of the class does not block the Qt's event loop.

Usage:

// prepare the callback function
std::function<void ()> callback(
std::bind(&KisCanvas2::setMonitorProfile, this,
monitorProfile, renderingIntent, conversionFlags));
// create the timer connected to the function
static void deferSignal(int delay, CallbackFunction function)
typedef void(QOPENGLF_APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC)(GLuint buffer)

TODO: rename KisDeferredSignal -> KisDeferredCallback

Definition at line 37 of file kis_deferred_signal.h.

Member Typedef Documentation

◆ CallbackFunction

using KisDeferredSignal::CallbackFunction = std::function<void ()>

Definition at line 41 of file kis_deferred_signal.h.

Constructor & Destructor Documentation

◆ KisDeferredSignal()

KisDeferredSignal::KisDeferredSignal ( int delay,
CallbackFunction function )
private

Member Function Documentation

◆ deferSignal()

static void KisDeferredSignal::deferSignal ( int delay,
CallbackFunction function )
static

Creates a timer which will call function after delay milliseconds

◆ timeout

void KisDeferredSignal::timeout ( )
privateslot

Member Data Documentation

◆ m_function

CallbackFunction KisDeferredSignal::m_function
private

Definition at line 57 of file kis_deferred_signal.h.


The documentation for this class was generated from the following file: