28 #include <QTreeWidget>
29 #include <QHeaderView>
46 QStringList headerLabels;
47 headerLabels << tr(
"Cost" )
48 << tr(
"Cost per call" )
50 << tr(
"Cost 2 per call" )
52 << ((_showCallers) ? tr(
"Caller" ) : tr(
"Callee" ));
53 setHeaderLabels(headerLabels);
56 setIconSize(QSize(99,99));
57 setAllColumnsShowFocus(
true);
58 setRootIsDecorated(
false);
59 setUniformRowHeights(
true);
61 sortByColumn(0, Qt::DescendingOrder);
70 setContextMenuPolicy(Qt::CustomContextMenu);
72 SIGNAL(customContextMenuRequested(
const QPoint &) ),
79 connect(header(), SIGNAL(sectionClicked(
int)),
86 tr(
"<b>List of direct Callers</b>"
87 "<p>This list shows all functions calling the "
88 "current selected one directly, together with "
89 "a call count and the cost spent in the current "
90 "selected function while being called from the "
91 "function from the list.</p>"
92 "<p>An icon instead of an inclusive cost specifies "
93 "that this is a call inside of a recursive cycle. "
94 "An inclusive cost makes no sense here.</p>"
95 "<p>Selecting a function makes it the current selected "
96 "one of this information panel. "
97 "If there are two panels (Split mode), the "
98 "function of the other panel is changed instead.</p>") :
99 tr(
"<b>List of direct Callees</b>"
100 "<p>This list shows all functions called by the "
101 "current selected one directly, together with "
102 "a call count and the cost spent in this function "
103 "while being called from the selected function.</p>"
104 "<p>Selecting a function makes it the current selected "
105 "one of this information panel. "
106 "If there are two panels (Split mode), the "
107 "function of the other panel is changed instead.</p>");
116 int col = columnAt(p.x());
121 QAction* activateFunctionAction = 0;
122 QAction* activateCycleAction = 0;
129 activateFunctionAction = popup.addAction(menuText);
133 QString menuText = tr(
"Go to '%1'").arg(name);
134 activateCycleAction = popup.addAction(menuText);
137 popup.addSeparator();
140 if ((col == 0) || (col == 1)) {
142 popup.addSeparator();
146 QAction* a = popup.exec(mapToGlobal(p + QPoint(0,header()->height())));
147 if (a == activateFunctionAction)
149 else if (a == activateCycleAction)
178 if (col == 3)
return;
181 sortByColumn(col, Qt::DescendingOrder);
187 if (item && ((event->key() == Qt::Key_Return) ||
188 (event->key() == Qt::Key_Space)))
195 QTreeView::keyPressEvent(event);
212 void CallView::doUpdate(
int changeType,
bool)
232 for (
int i=0; i<topLevelItemCount();i++) {
233 item = topLevelItem(i);
238 setCurrentItem(item);
242 if (!item && ci) clearSelection();
248 for (
int i=0; i<topLevelItemCount(); i++){
249 item = topLevelItem(i);
258 void CallView::refresh()
265 headerItem()->setText(1, tr(
"%1 per call").arg(
_eventType->
name()));
283 items.append(
new CallItem(
this, 0, call));
286 setSortingEnabled(
false);
287 addTopLevelItems(items);
288 setSortingEnabled(
true);
290 header()->setSortIndicatorShown(
false);
292 header()->resizeSections(QHeaderView::ResizeToContents);
295 setColumnWidth(2, 0);
296 setColumnWidth(3, 0);
300 #include "callview.moc"
SubCost subCost(EventType *)
Returns a sub cost.
QString whatsThis() const
const TraceCallList & callings(bool skipCycle=false) const
void addEventTypeMenu(QMenu *, bool withCost2=true)
TraceFunction * caller(bool skipCycle=false) const
ProfileContext::Type type() const
TraceFunctionCycle * cycle()
Base class for cost items.
TraceFunction * activeFunction()
TraceCallList callers(bool skipCycle=false) const
Abstract Base Class for KCachegrind Views.
QString callerName(bool skipCycle=false) const
void context(const QPoint &)
void selectedSlot(QTreeWidgetItem *, QTreeWidgetItem *)
void keyPressEvent(QKeyEvent *event)
static QString shortenSymbol(const QString &)
void activatedSlot(QTreeWidgetItem *, int)
CallView(bool showCallers, TraceItemView *parentView, QWidget *parent=0)
virtual void selected(TraceItemView *sender, CostItem *)
Notification from child views.
virtual void activated(TraceItemView *sender, CostItem *)
TraceFunction * called(bool skipCycle=false) const
QList< TraceCall * > TraceCallList
A call from one to another function.
QString calledName(bool skipCycle=false) const