-
Notifications
You must be signed in to change notification settings - Fork 1
/
SignalGuard.cpp
46 lines (38 loc) · 1.07 KB
/
SignalGuard.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* \file SignalGuard.cpp
* \brief
*/
#include "SignalGuard.h"
#include "Utils.h"
namespace qtlib
{
/**************************************************************************************************
* public
*
**************************************************************************************************/
//-------------------------------------------------------------------------------------------------
SignalGuard::SignalGuard(
QObject *a_target,
cchar *a_slot
)
{
connect(this, SIGNAL( sig_trigger() ),
a_target, a_slot);
}
//-------------------------------------------------------------------------------------------------
SignalGuard::~SignalGuard()
{
if (_isEmit) {
Q_EMIT sig_trigger();
}
}
//-------------------------------------------------------------------------------------------------
void
SignalGuard::setEmit(
cbool a_flag
)
{
_isEmit = a_flag;
}
//-------------------------------------------------------------------------------------------------
} // namespace qtlib