IApplication::TimerId QtApplication::startTimer(int interval_ms, TimerCallback callback) { if (application_ == nullptr) return 0; auto timer = new QTimer(application_.get()); QObject::connect(timer, &QTimer::timeout, [callback]() { callback(); }); timer->start(interval_ms); timers_[timer->timerId()] = timer; return timer->timerId(); }
int QTimer::start(int msec, bool sshot) { if (id >=0 && nulltimer && !msec && sshot) return id; stop(); setInterval(msec); setSingleShot(sshot); start(); return timerId(); }
bool CoreIrcListHelper::dispatchQuery(const NetworkId &netId, const QString &query) { CoreNetwork *network = coreSession()->network(netId); if (network) { _channelLists[netId] = QList<ChannelDescription>(); network->userInputHandler()->handleList(BufferInfo(), query); auto timer = std::make_shared<QBasicTimer>(); timer->start(kTimeoutMs, this); _queryTimeoutByNetId[netId] = timer; _queryTimeoutByTimerId[timer->timerId()] = netId; return true; } else { return false; } }