void StackSelection::setFunction(TraceFunction* f) { if (_function == f) return; _function = f; if (!_data || !_function) return; //qDebug() << "StackSelection::setFunction " << f->name(); HistoryItem* item = _browser->current(); if (!item || item->function() != f) { _browser->select(f); rebuildStackList(); } }
void StackSelection::rebuildStackList() { HistoryItem* item = _browser->current(); _stackList->clear(); _stackList->setColumnWidth(0, 50); _stackList->setColumnWidth(1, _eventType2 ? 50:0); _stackList->setColumnWidth(2, 50); if (!item || !item->stack()) return; TraceFunction* top = item->stack()->top(); if (!top) return; _stackList->setColumnWidthMode(1, Q3ListView::Maximum); TraceCallList l = item->stack()->calls(); TraceCall* call; for (call=l.last();call;call=l.prev()) new StackItem(this, _stackList, call); new StackItem(this, _stackList, top); // select current function Q3ListViewItem* i = _stackList->firstChild(); for (;i;i=i->nextSibling()) if (((StackItem*)i)->function() == item->function()) break; if (i) { // this calls stackFunctionSelected() _stackList->setCurrentItem(i); _stackList->ensureItemVisible(i); } if (!_eventType2) { _stackList->setColumnWidthMode(1, Q3ListView::Manual); _stackList->setColumnWidth(1, 0); } }