28 #include <QHeaderView>
39 QWidget* parent,
const char* name)
44 setIconSize(QSize(99,99));
47 labels << tr(
"Event Type" )
53 setHeaderLabels(labels);
55 header()->setMinimumSectionSize(10);
57 setRootIsDecorated(
false);
58 setSortingEnabled(
false);
59 setAllColumnsShowFocus(
true);
63 setContextMenuPolicy(Qt::CustomContextMenu);
65 SIGNAL(customContextMenuRequested(
const QPoint &)),
66 SLOT(context(
const QPoint &)));
86 return tr(
"<b>Cost Types List</b>"
87 "<p>This list shows all cost types available "
88 "and what the self/inclusive cost of the "
89 "current selected function is for that cost type.</p>"
90 "<p>By choosing a cost type from the list, "
91 "you change the cost type of costs shown "
92 "all over KCachegrind to be the selected one.</p>");
96 void EventTypeView::context(
const QPoint & p)
103 QAction* selectType2Action = 0;
104 QAction* hideType2Action = 0;
106 selectType2Action = popup.addAction(tr(
"Set as Secondary Event Type"));
108 hideType2Action = popup.addAction(tr(
"Hide Secondary Event Type"));
109 if (!popup.isEmpty())
110 popup.addSeparator();
112 QAction* editLongNameAction = 0;
113 QAction* editShortNameAction = 0;
114 QAction* editFormulaAction = 0;
115 QAction* removeTypeAction = 0;
116 if (ct && !ct->isReal()) {
117 editLongNameAction = popup.addAction(tr(
"Edit Long Name"));
118 editShortNameAction = popup.addAction(tr(
"Edit Short Name"));
119 editFormulaAction = popup.addAction(tr(
"Edit Formula"));
120 removeTypeAction = popup.addAction(tr(
"Remove"));
121 popup.addSeparator();
126 QAction* newTypeAction = 0;
128 popup.addSeparator();
129 newTypeAction = popup.addAction(tr(
"New Event Type..."));
132 QAction* a = popup.exec(viewport()->mapToGlobal(p));
135 else if (a == editLongNameAction) editItem(i, 0);
136 else if (a == editShortNameAction) editItem(i, 3);
137 else if (a == editFormulaAction) editItem(i, 5);
138 else if (a == removeTypeAction) {
161 else if (a == newTypeAction) {
169 QString shortName = tr(
"New%1").arg(i);
170 QString longName = tr(
"New Event Type %1").arg(i);
216 void EventTypeView::doUpdate(
int changeType,
bool)
224 for(
int i = 0; i < topLevelItemCount(); i++)
231 for(
int i = 0; i < topLevelItemCount(); i++) {
234 setCurrentItem(item);
244 for(
int i = 0; i < topLevelItemCount(); i++)
254 void EventTypeView::refresh()
257 setColumnWidth(1, 50);
258 setColumnWidth(2, 50);
277 QString sumStr, pureStr;
293 insertTopLevelItems(0,items);
296 setCurrentItem(selected);
297 scrollToItem(selected);
300 for(
int c = 0; c<6; c++)
301 resizeColumnToContents(c);
307 if (!ct || ct->
isReal())
return;
312 for (
int i=0; i<knownCount; i++) {
314 if (known->
name() == ct->
name())
break;
317 QString t = item->text(c);
336 #include "eventtypeview.moc"
virtual void selectedEventType2(TraceItemView *sender, EventType *)
ProfileContext::Type type() const
void setFormula(const QString &)
Base class for cost items.
EventTypeSet * eventTypes()
ProfileContext::Type _groupType
static EventType * knownDerivedType(const QString &)
Abstract Base Class for KCachegrind Views.
QString whatsThis() const
static int knownTypeCount()
virtual void selected(TraceItemView *sender, CostItem *)
Notification from child views.
EventType * realType(int)
static EventType * knownType(int)
static void add(EventType *, bool overwriteExisting=true)
void setName(const QString &n)
A class for managing a set of event types.
void setLongName(const QString &n)
virtual void configChanged()=0
EventType * derivedType(int)
EventTypeView(TraceItemView *parentView, QWidget *parent=0, const char *name=0)
virtual void selectedEventType(TraceItemView *sender, EventType *)