#include <gTimer.h>
继承自 GObject .
Public 成员函数 | |
GTimer (GObject *parent=0, const char *name=0, bool sshot=false) | |
构造一个定时器 更多... | |
virtual | ~GTimer () |
bool | isActive () const |
是否正在运行 更多... | |
int | start (int msec, bool sshot=false) |
启动定时器 更多... | |
void | stop () |
停止定时器 更多... | |
int | restart () |
重新启动定时器 更多... | |
virtual bool | event (GEvent *) |
开发者可以在子类中覆盖此函数,处理自己需要的事件 更多... | |
const char * | name () const |
获取对象名称 更多... | |
GObject * | parent () const |
获取对象的parent 更多... | |
静态 Public 成员函数 | |
template<class Receiver > | |
static void | singleShot (int msec, Receiver *receiver, void(Receiver::*SlotFunc)()) |
执行一个一次性定时操作。超时会执行指定的槽函数 更多... | |
template<class Receiver , typename... Args> | |
static int | connect (GObject *sender, GSignal< void(Args...)> &signal, Receiver *receiver, void(Receiver::*SlotFunc)(Args...)) |
将信号和槽建立连接。 Receiver代表接收者的类型 Args是槽函数/信号的参数列表。 更多... | |
template<class Receiver , typename... Args> | |
static int | disconnect (GObject *sender, GSignal< void(Args...)> &signal, Receiver *receiver, void(Receiver::*SlotFunc)(Args...)) |
将信号和槽断开连接。 Receiver代表接收者的类型 Args是槽函数/信号的参数列表。 更多... | |
static bool | isObjectExist (GObject *obj) |
判断对象是否已经被析构掉了。 更多... | |
Public 属性 | |
GSignal< void(void)> | timeout |
当定时器超时,该信号被发射。 更多... | |
GSignal< void(void)> | sigDestroyed |
当对象被析构时,会发射此信号 更多... | |
友元 | |
class | GTimerEvent |
GTimer 定时器
GTimer::GTimer | ( | GObject * | parent = 0 , |
const char * | name = 0 , |
||
bool | sshot = false |
||
) |
构造一个定时器
parent | ... |
name | ... |
sshot | 系统保留参数,开发者不可使用,否则将给你带来莫名其妙的问题 |
|
virtual |
|
staticinherited |
将信号和槽建立连接。
Receiver代表接收者的类型 Args是槽函数/信号的参数列表。
sender | 指向发射者的指针 |
signal | 指向信号的引用。 |
receiver | 指向接收者的指针 |
SlotFunc | 指向槽函数的指针 |
|
staticinherited |
将信号和槽断开连接。
Receiver代表接收者的类型 Args是槽函数/信号的参数列表。
sender | 指向发射者的指针 |
signal | 指向信号的引用。 |
receiver | 指向接收者的指针 |
SlotFunc | 指向槽函数的指针 |
bool GTimer::isActive | ( | ) | const |
是否正在运行
|
staticinherited |
判断对象是否已经被析构掉了。
obj | ... |
|
inherited |
获取对象名称
|
inherited |
获取对象的parent
int GTimer::restart | ( | ) |
重新启动定时器
|
inlinestatic |
执行一个一次性定时操作。超时会执行指定的槽函数
msec | 超时,单位为毫秒 |
receiver | 接收者 |
SlotFunc | 接收者的槽函数(用于接收超时信号) |
int GTimer::start | ( | int | msec, |
bool | sshot = false |
||
) |
启动定时器
msec | 超时,单位为毫秒 |
sshot |
void GTimer::stop | ( | ) |
停止定时器
|
friend |
|
inherited |
当对象被析构时,会发射此信号
GSignal<void(void)> GTimer::timeout |
当定时器超时,该信号被发射。