QModelIndex ApiTraceModel::indexForCall(ApiTraceCall *call) const { if (!call) { return QModelIndex(); } ApiTraceFrame *frame = call->parentFrame(); Q_ASSERT(frame); int row = frame->callIndex(call); if (row < 0) { qDebug() << "Couldn't find call num "<<call->index()<<" inside parent!"; return QModelIndex(); } return createIndex(row, 0, call); }
void ApiTraceModel::stateSetOnEvent(ApiTraceEvent *event) { if (!event) return; if (event->type() == ApiTraceEvent::Call) { ApiTraceCall *call = static_cast<ApiTraceCall*>(event); ApiTraceFrame *frame = call->parentFrame(); int row = frame->callIndex(call); QModelIndex index = createIndex(row, 0, 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(); ApiTraceFrame *frame = call->parentFrame(); int row = frame->callIndex(call); QModelIndex index = createIndex(row, 0, call); emit dataChanged(index, index); }