本文整理汇总了C++中TimerInfoPtr类的典型用法代码示例。如果您正苦于以下问题:C++ TimerInfoPtr类的具体用法?C++ TimerInfoPtr怎么用?C++ TimerInfoPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TimerInfoPtr类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: findOrCreateFreeTimerInfo
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: findOrCreateQTimerTimerInfo
void TimerModel::preSignalActivate(QObject *caller, int methodIndex)
{
if (!(methodIndex == m_timeoutIndex && qobject_cast<QTimer*>(caller)) &&
!(methodIndex == m_qmlTimerTriggeredIndex && caller->inherits("QQmlTimer")))
{
return;
}
const TimerInfoPtr timerInfo = findOrCreateQTimerTimerInfo(caller);
if (!timerInfo) {
// Ok, likely a GammaRay timer
//cout << "TimerModel::preSignalActivate(): Unable to find timer "
// << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
return;
}
if (!timerInfo->functionCallTimer()->start()) {
cout << "TimerModel::preSignalActivate(): Recursive timeout for timer "
<< (void*)caller << " (" << caller->objectName().toStdString() << ")!" << endl;
return;
}
Q_ASSERT(!m_currentSignals.contains(caller));
m_currentSignals[caller] = timerInfo;
}
开发者ID:nataliakoval,项目名称:GammaRay,代码行数:26,代码来源:timermodel.cpp
示例3: Q_ASSERT
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
示例4: findOrCreateQTimerTimerInfo
void TimerModel::preSignalActivate(QObject *caller, int methodIndex)
{
if (methodIndex != m_timeoutIndex) {
return;
}
QTimer *timer = qobject_cast<QTimer*>(caller);
if (!timer || timer->objectName().toLower().startsWith(QLatin1String("gammaray"))) {
return;
}
const TimerInfoPtr timerInfo = findOrCreateQTimerTimerInfo(timer);
if (!timerInfo) {
// Ok, likely a GammaRay timer
//cout << "TimerModel::preSignalActivate(): Unable to find timer "
// << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
return;
}
if (!timerInfo->functionCallTimer()->start()) {
cout << "TimerModel::preSignalActivate(): Recursive timeout for timer "
<< (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
return;
}
Q_ASSERT(!m_currentSignals.contains(caller));
m_currentSignals[caller] = timerInfo;
}
开发者ID:motto0808,项目名称:GammaRay,代码行数:29,代码来源:timermodel.cpp
示例5: QVariant
QVariant TimerModel::data(const QModelIndex &index, int role) const
{
if (!m_sourceModel || !index.isValid())
return QVariant();
if (role == Qt::DisplayRole) {
const TimerInfoPtr timerInfo = const_cast<TimerModel *>(this)->findOrCreateTimerInfo(index);
switch (index.column()) {
case ObjectNameColumn:
return timerInfo->displayName();
case StateColumn:
return timerInfo->state();
case TotalWakeupsColumn:
return timerInfo->totalWakeups();
case WakeupsPerSecColumn:
return timerInfo->wakeupsPerSec();
case TimePerWakeupColumn:
return timerInfo->timePerWakeup();
case MaxTimePerWakeupColumn:
return timerInfo->maxWakeupTime();
case TimerIdColumn:
return timerInfo->timerId();
case ColumnCount:
break;
}
}
if (role == ObjectIdRole && index.column() == 0) {
const TimerInfoPtr timerInfo = const_cast<TimerModel*>(this)->findOrCreateTimerInfo(index);
return QVariant::fromValue(ObjectId(timerInfo->timerObject()));
}
return QVariant();
}
开发者ID:giucam,项目名称:GammaRay,代码行数:34,代码来源:timermodel.cpp
示例6: findOrCreateTimerInfo
int TimerModel::rowFor(QObject *timer)
{
for (int i = 0; i < rowCount(); i++) {
const TimerInfoPtr timerInfo = findOrCreateTimerInfo(index(i, 0));
if (timerInfo && timerInfo->timerObject() == timer)
return i;
}
return -1;
}
开发者ID:xhaakon,项目名称:GammaRay,代码行数:9,代码来源:timermodel.cpp
示例7: QVariant
QVariant TimerModel::data(const QModelIndex &index, int role) const
{
if (!m_sourceModel)
return QVariant();
if (role == Qt::DisplayRole && index.isValid()
&& index.column() >= 0 && index.column() < columnCount()) {
const TimerInfoPtr timerInfo = const_cast<TimerModel *>(this)->findOrCreateTimerInfo(index);
switch ((Roles)(index.column() + FirstRole + 1)) {
case ObjectNameRole:
return timerInfo->displayName();
case StateRole:
return timerInfo->state();
case TotalWakeupsRole:
return timerInfo->totalWakeups();
case WakeupsPerSecRole:
return timerInfo->wakeupsPerSec();
case TimePerWakeupRole:
return timerInfo->timePerWakeup();
case MaxTimePerWakeupRole:
return timerInfo->maxWakeupTime();
case TimerIdRole:
return timerInfo->timerId();
case FirstRole:
case LastRole:
break;
}
}
return QVariant();
}
开发者ID:xhaakon,项目名称:GammaRay,代码行数:30,代码来源:timermodel.cpp
示例8: findOrCreateQTimerTimerInfo
void TimerModel::preSignalActivate(QTimer *timer)
{
const TimerInfoPtr timerInfo = findOrCreateQTimerTimerInfo(timer);
if (timerInfo) {
if (!timerInfo->functionCallTimer()->start()) {
cout << "TimerModel::preSignalActivate(): Recursive timeout for timer "
<< (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
}
} else {
// Ok, likely a GammaRay timer
//cout << "TimerModel::preSignalActivate(): Unable to find timer "
// << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
}
}
开发者ID:frankosterfeld,项目名称:GammaRay,代码行数:14,代码来源:timermodel.cpp
示例9: TimerInfoPtr
TimerInfoPtr TimerModel::findOrCreateQTimerTimerInfo(QTimer *timer)
{
if (!timer) {
return TimerInfoPtr();
}
QVariant timerInfoVariant = timer->property(timerInfoPropertyName);
if (!timerInfoVariant.isValid()) {
timerInfoVariant.setValue(TimerInfoPtr(new TimerInfo(timer)));
timer->setProperty(timerInfoPropertyName, timerInfoVariant);
}
const TimerInfoPtr timerInfo = timerInfoVariant.value<TimerInfoPtr>();
Q_ASSERT(timerInfo->timer() == timer);
return timerInfo;
}
开发者ID:frankosterfeld,项目名称:GammaRay,代码行数:16,代码来源:timermodel.cpp
示例10: TimerInfoPtr
TimerInfoPtr TimerModel::findOrCreateQTimerTimerInfo(QTimer *timer)
{
if (!timer) {
return TimerInfoPtr();
}
QVariant timerInfoVariant = timer->property(timerInfoPropertyName);
if (!timerInfoVariant.isValid()) {
timerInfoVariant.setValue(TimerInfoPtr(new TimerInfo(timer)));
if (timer->thread() == QThread::currentThread()) // ### FIXME: we shouldn't use setProperty() in the first place...
timer->setProperty(timerInfoPropertyName, timerInfoVariant);
}
const TimerInfoPtr timerInfo = timerInfoVariant.value<TimerInfoPtr>();
Q_ASSERT(timerInfo->timer() == timer);
return timerInfo;
}
开发者ID:motto0808,项目名称:GammaRay,代码行数:17,代码来源:timermodel.cpp
示例11: TimerInfoPtr
TimerInfoPtr TimerModel::findOrCreateQTimerTimerInfo(QObject *timer)
{
if (!timer)
return TimerInfoPtr();
QVariant timerInfoVariant = timer->property(timerInfoPropertyName);
if (!timerInfoVariant.isValid()) {
const TimerInfoPtr info = TimerInfoPtr(new TimerInfo(timer));
if (m_qmlTimerTriggeredIndex < 0 && info->type() == TimerInfo::QQmlTimerType)
m_qmlTimerTriggeredIndex = timer->metaObject()->indexOfMethod("triggered()");
timerInfoVariant.setValue(info);
if (timer->thread() == QThread::currentThread()) // ### FIXME: we shouldn't use setProperty() in the first place...
timer->setProperty(timerInfoPropertyName, timerInfoVariant);
}
const TimerInfoPtr timerInfo = timerInfoVariant.value<TimerInfoPtr>();
Q_ASSERT(timerInfo->timerObject() == timer);
return timerInfo;
}
开发者ID:xhaakon,项目名称:GammaRay,代码行数:19,代码来源:timermodel.cpp
示例12: 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:xhaakon,项目名称:GammaRay,代码行数:40,代码来源:timermodel.cpp
示例13: 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
注:本文中的TimerInfoPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论