Main Page
Related Pages
+
Namespaces
Namespace List
+
Namespace Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
+
Enumerations
a
b
c
d
e
g
i
l
m
o
p
r
s
t
v
+
Enumerator
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
x
y
+
Classes
Class List
Class Hierarchy
+
Class Members
+
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
_
a
b
c
d
e
f
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
+
Enumerations
a
b
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
w
+
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Properties
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
+
Related Functions
:
a
b
c
d
e
f
g
i
m
o
q
r
s
v
w
+
Files
File List
+
File Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Variables
_
a
b
c
d
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
+
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
p
q
r
s
t
u
v
w
x
z
+
Enumerations
a
b
c
d
e
f
h
i
k
l
n
o
r
t
u
v
x
+
Enumerator
b
c
d
e
f
h
i
k
l
m
n
o
p
r
t
u
v
w
x
+
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
plotjuggler_base
include
PlotJuggler
util
delayed_callback.hpp
Go to the documentation of this file.
1
/*
2
* This Source Code Form is subject to the terms of the Mozilla Public
3
* License, v. 2.0. If a copy of the MPL was not distributed with this
4
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
*/
6
7
#ifndef PJ_DELAYED_CALLBACK_HPP
8
#define PJ_DELAYED_CALLBACK_HPP
9
10
#include <QTimer>
11
#include <QMetaMethod>
12
#include <functional>
13
14
namespace
PJ
15
{
16
// Simple utility to avoid triggering a certain slot too often
17
class
DelayedCallback
18
{
19
public
:
20
DelayedCallback
()
21
{
22
_delay_timer
=
new
QTimer();
23
_delay_timer
->setSingleShot(
true
);
24
}
25
26
~DelayedCallback
()
27
{
28
delete
_delay_timer
;
29
}
30
31
template
<
class
Function>
32
void
connectCallback
(Function callback)
33
{
34
QObject::connect(
_delay_timer
, &QTimer::timeout, callback);
35
}
36
37
void
triggerSignal
(
int
delay_ms)
38
{
39
if
(!
_delay_timer
->isActive())
40
{
41
_delay_timer
->start(delay_ms);
42
}
43
}
44
45
private
:
46
QTimer*
_delay_timer
;
47
};
48
49
}
// namespace PJ
50
51
#endif // PJ_DELAYED_CALLBACK_HPP
PJ::DelayedCallback::DelayedCallback
DelayedCallback()
Definition:
delayed_callback.hpp:20
PJ::DelayedCallback::~DelayedCallback
~DelayedCallback()
Definition:
delayed_callback.hpp:26
PJ
Definition:
dataloader_base.h:17
PJ::DelayedCallback
Definition:
delayed_callback.hpp:17
PJ::DelayedCallback::triggerSignal
void triggerSignal(int delay_ms)
Definition:
delayed_callback.hpp:37
PJ::DelayedCallback::_delay_timer
QTimer * _delay_timer
Definition:
delayed_callback.hpp:46
PJ::DelayedCallback::connectCallback
void connectCallback(Function callback)
Definition:
delayed_callback.hpp:32
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Jun 19 2023 03:01:02