当前位置: 首页>>代码示例>>C++>>正文


C++ TimerInfoPtr::addEvent方法代码示例

本文整理汇总了C++中TimerInfoPtr::addEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ TimerInfoPtr::addEvent方法的具体用法?C++ TimerInfoPtr::addEvent怎么用?C++ TimerInfoPtr::addEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TimerInfoPtr的用法示例。


在下文中一共展示了TimerInfoPtr::addEvent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: eventFilter

bool TimerModel::eventFilter(QObject *watched, QEvent *event)
{
    if (event->type() == QEvent::Timer) {
        QTimerEvent * const timerEvent = static_cast<QTimerEvent *>(event);

        // If there is a QTimer associated with this timer ID, don't handle it here, it will be handled
        // by the signal hooks for QTimer::timeout()
        if (findOrCreateQTimerTimerInfo(timerEvent->timerId()))
            return false;

        // check if object is owned by GammaRay itself
        if (m_probe && m_probe->filterObject(watched))
            return false;

        const TimerInfoPtr timerInfo = findOrCreateFreeTimerInfo(timerEvent->timerId());
        TimerInfo::TimeoutEvent timeoutEvent;
        timeoutEvent.timeStamp = QTime::currentTime();
        timeoutEvent.executionTime = -1;
        timerInfo->addEvent(timeoutEvent);

        timerInfo->setLastReceiver(watched);
        emitFreeTimerChanged(m_freeTimers.indexOf(timerInfo));
    }
    return false;
}
开发者ID:xhaakon,项目名称:GammaRay,代码行数:25,代码来源:timermodel.cpp

示例2: eventFilter

bool TimerModel::eventFilter(QObject *watched, QEvent *event)
{
    if (event->type() == QEvent::Timer) {

        QTimerEvent * const timerEvent = dynamic_cast<QTimerEvent*>(event);
        Q_ASSERT(timerEvent);

        // If there is a QTimer associated with this timer ID, don't handle it here, it will be handled
        // by the signal hooks for QTimer::timeout()
        if (findOrCreateQTimerTimerInfo(timerEvent->timerId())) {
            return false;
        }

        if (Probe::instance()->filterObject(watched)) {
            return false;
        }

        const TimerInfoPtr timerInfo = findOrCreateFreeTimerInfo(timerEvent->timerId());
        TimerInfo::TimeoutEvent timeoutEvent;
        timeoutEvent.timeStamp = QTime::currentTime();
        timeoutEvent.executionTime = -1;
        timerInfo->addEvent(timeoutEvent);

        timerInfo->setLastReceiver(watched);
    }
    return false;
}
开发者ID:frankosterfeld,项目名称:GammaRay,代码行数:27,代码来源:timermodel.cpp

示例3: postSignalActivate

void TimerModel::postSignalActivate(QObject *caller, int methodIndex)
{
  QHash<QObject*, TimerInfoPtr>::iterator it = m_currentSignals.find(caller);
  if (it == m_currentSignals.end()) {
    // Ok, likely a GammaRay timer
    // cout << "TimerModel::postSignalActivate(): Unable to find timer "
    //      << (void*)caller << " (" << caller->objectName().toStdString() << ")!" << endl;
    return;
  }

  const TimerInfoPtr timerInfo = *it;
  Q_ASSERT(timerInfo);

  if (!(timerInfo->type() == TimerInfo::QTimerType && methodIndex == m_timeoutIndex) &&
      !(timerInfo->type() == TimerInfo::QQmlTimerType && methodIndex == m_qmlTimerTriggeredIndex))
  {
    return;
  }

  m_currentSignals.erase(it);

  if (!timerInfo->timerObject()) {
    // timer got killed in a slot
    return;
  }

  Q_ASSERT(caller == timerInfo->timerObject());

  if (!timerInfo->functionCallTimer()->active()) {
    cout << "TimerModel::postSignalActivate(): Timer not active: "
          << (void*)caller << " (" << caller->objectName().toStdString() << ")!" << endl;
    return;
  }

  TimerInfo::TimeoutEvent event;
  event.timeStamp = QTime::currentTime();
  event.executionTime = timerInfo->functionCallTimer()->stop();
  timerInfo->addEvent(event);
  const int row = rowFor(timerInfo->timerObject());
  emitTimerObjectChanged(row);
}
开发者ID:nataliakoval,项目名称:GammaRay,代码行数:41,代码来源:timermodel.cpp

示例4: postSignalActivate

void TimerModel::postSignalActivate(QObject *caller, int methodIndex)
{
  if (methodIndex != m_timeoutIndex) {
    return;
  }
  QHash<QObject*, TimerInfoPtr>::iterator it = m_currentSignals.find(caller);
  if (it == m_currentSignals.end()) {
    // Ok, likely a GammaRay timer
    //cout << "TimerModel::postSignalActivate(): Unable to find timer "
    //     << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
    return;
  }

  const TimerInfoPtr timerInfo = *it;
  Q_ASSERT(timerInfo);

  m_currentSignals.erase(it);

  if (!timerInfo->timer()) {
    // timer got killed in a slot
    return;
  }

  Q_ASSERT(static_cast<QTimer*>(caller) == timerInfo->timer());

  if (!timerInfo->functionCallTimer()->active()) {
    cout << "TimerModel::postSignalActivate(): Timer not active: "
          << (void*)caller << " (" << caller->objectName().toStdString() << ")!" << endl;
    return;
  }

  TimerInfo::TimeoutEvent event;
  event.timeStamp = QTime::currentTime();
  event.executionTime = timerInfo->functionCallTimer()->stop();
  timerInfo->addEvent(event);
  const int row = rowFor(timerInfo->timer());
  if (row != -1) {
    emit dataChanged(index(row, 0), index(row, columnCount() - 1));
  }
}
开发者ID:motto0808,项目名称:GammaRay,代码行数:40,代码来源:timermodel.cpp

示例5: postSignalActivate

void TimerModel::postSignalActivate(QTimer *timer)
{
    const TimerInfoPtr timerInfo = findOrCreateQTimerTimerInfo(timer);
    if (timerInfo) {
        if (!timerInfo->functionCallTimer()->active()) {
            cout << "TimerModel::postSignalActivate(): Timer not active: "
                 << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
        } else {
            TimerInfo::TimeoutEvent event;
            event.timeStamp = QTime::currentTime();
            event.executionTime = timerInfo->functionCallTimer()->stop();
            timerInfo->addEvent(event);
            const int row = rowFor(timer);
            if (row != -1) {
                emit dataChanged(index(row, 0), index(row, columnCount() - 1));
            }
        }
    } else {
        // Ok, likely a GammaRay timer
        //cout << "TimerModel::postSignalActivate(): Unable to find timer "
        //     << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
    }
}
开发者ID:frankosterfeld,项目名称:GammaRay,代码行数:23,代码来源:timermodel.cpp


注:本文中的TimerInfoPtr::addEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。