28 #include <QTreeWidget>
29 #include <QHeaderView>
44 _inSelectionUpdate =
false;
46 QStringList headerLabels;
47 headerLabels << tr(
"Profile Part" )
52 setHeaderLabels(headerLabels);
54 setAllColumnsShowFocus(
true);
55 setRootIsDecorated(
false);
56 setUniformRowHeights(
true);
58 sortByColumn(0, Qt::DescendingOrder);
60 setSelectionMode(QAbstractItemView::ExtendedSelection);
62 connect(
this, SIGNAL(itemSelectionChanged()),
63 SLOT( selectionChangedSlot() ) );
65 setContextMenuPolicy(Qt::CustomContextMenu);
67 SIGNAL(customContextMenuRequested(
const QPoint &) ),
68 SLOT(context(
const QPoint &)));
70 connect(header(), SIGNAL(sectionClicked(
int)),
71 this, SLOT(headerClicked(
int)));
78 return tr(
"<b>Trace Part List</b>"
79 "<p>This list shows all trace parts of the loaded "
80 "trace. For each part, the "
81 "self/inclusive cost of the current selected "
82 "function, spent in the part, is shown; "
83 "percentage costs are always relative to the "
84 "total cost <em>of the part</em> (not to the whole "
85 "trace as in the Trace Part Overview). "
86 "Also shown are the calls happening to/from the "
87 "current function inside of the trace part.</p>"
88 "<p>By choosing one or more trace parts from the "
89 "list, the costs shown all over KCachegrind will "
90 "only be the ones spent in the selected part(s). "
91 "If no list selection is shown, in fact all trace "
92 "parts are selected implicitly.</p>"
93 "<p>This is a multi-selection list. You can select "
94 "ranges by dragging the mouse or use SHIFT/CTRL "
96 "Selection/Deselection of trace parts can also be "
97 "done by using the Trace Part Overview Dockable. "
98 "This one also supports multiple selection.</p>"
99 "<p>Note that the list is hidden if only one trace "
100 "part is loaded.</p>");
104 void PartView::context(
const QPoint & p)
110 popup.exec(mapToGlobal(p + QPoint(0,header()->height())));
114 void PartView::selectionChangedSlot()
116 if (_inSelectionUpdate)
return;
129 void PartView::headerClicked(
int col)
132 if ((col == 0) || (col == 4))
return;
135 sortByColumn(col, Qt::DescendingOrder);
145 void PartView::doUpdate(
int changeType,
bool)
153 for (
int i=0; i<topLevelItemCount(); i++){
154 item = topLevelItem(i);
161 #if QT_VERSION >= 0x050000
162 header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
163 header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
165 header()->setResizeMode(1, QHeaderView::ResizeToContents);
166 header()->setResizeMode(2, QHeaderView::ResizeToContents);
170 setSortingEnabled(
false);
171 for (
int i=0; i< topLevelItemCount(); i++) {
175 #if QT_VERSION >= 0x050000
176 header()->setSectionResizeMode(1, QHeaderView::Interactive);
177 header()->setSectionResizeMode(2, QHeaderView::Interactive);
179 header()->setResizeMode(1, QHeaderView::Interactive);
180 header()->setResizeMode(2, QHeaderView::Interactive);
182 setSortingEnabled(
true);
183 header()->setSortIndicatorShown(
false);
192 _inSelectionUpdate =
true;
193 for (
int i=0; i< topLevelItemCount(); i++) {
198 item->setSelected(
true);
202 item->setSelected(
false);
204 _inSelectionUpdate =
false;
214 setColumnWidth(1, 50);
215 setColumnWidth(2, 50);
231 _inSelectionUpdate =
true;
237 if (hidden.contains(part))
continue;
241 setSortingEnabled(
false);
242 addTopLevelItems(items);
243 setSortingEnabled(
true);
244 header()->setSortIndicatorShown(
false);
245 header()->resizeSections(QHeaderView::ResizeToContents);
247 foreach(item, items) {
249 if (hidden.contains(part))
continue;
251 item->setSelected(
true);
256 _inSelectionUpdate =
false;
259 #include "partview.moc"
virtual void partsSelected(TraceItemView *sender, const TracePartList &)
QString whatsThis() const
ProfileContext::Type type() const
For info tab, trace part list.
Base class for cost items.
virtual TracePart * part()
ProfileContext::Type _groupType
void setEventType(EventType *ct)
Abstract Base Class for KCachegrind Views.
TracePartList parts() const
virtual TracePartList hiddenParts()=0
A Trace Part: All data read from a trace file, containing all costs that happened in a specified time...
QList< TracePart * > TracePartList
PartView(TraceItemView *parentView, QWidget *parent=0)