void ApiTraceModel::stateSetOnEvent(ApiTraceEvent *event) { if (!event) return; if (event->type() == ApiTraceEvent::Call) { ApiTraceCall *call = static_cast<ApiTraceCall*>(event); QModelIndex index = indexForCall(call); emit dataChanged(index, index); } else if (event->type() == ApiTraceEvent::Frame) { ApiTraceFrame *frame = static_cast<ApiTraceFrame*>(event); const QList<ApiTraceFrame*> & frames = m_trace->frames(); int row = frames.indexOf(frame); QModelIndex index = createIndex(row, 0, frame); emit dataChanged(index, index); } }
void ApiTraceModel::callChanged(ApiTraceCall *call) { ApiTrace *trace = call->parentFrame()->parentTrace(); #if 0 qDebug()<<"Call changed = "<<call->edited(); qDebug()<<"\ttrace edited = "<<trace->edited(); qDebug()<<"\ttrace file = "<<trace->fileName(); qDebug()<<"\ttrace needs saving = "<<trace->needsSaving(); #endif Q_ASSERT(trace); if (trace->needsSaving()) trace->save(); QModelIndex index = indexForCall(call); emit dataChanged(index, index); }
QModelIndex ApiTraceModel::callIndex(int callNum) const { ApiTraceCall *call = m_trace->callWithIndex(callNum); return indexForCall(call); }