• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

kcachegrind

  • sources
  • kde-4.12
  • kdesdk
  • kcachegrind
  • libviews
sourceitem.h
Go to the documentation of this file.
1 /* This file is part of KCachegrind.
2  Copyright (C) 2011 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
3 
4  KCachegrind is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public
6  License as published by the Free Software Foundation, version 2.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; see the file COPYING. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 /*
20  * Items of source view.
21  */
22 
23 #ifndef SOURCEITEM_H
24 #define SOURCEITEM_H
25 
26 #include <QTreeWidget>
27 #include <QItemDelegate>
28 
29 #include "tracedata.h"
30 
31 class SourceView;
32 
33 class SourceItem: public QTreeWidgetItem
34 {
35 public:
36  // for source lines
37  SourceItem(SourceView* sv, QTreeWidget* parent,
38  int fileno, unsigned int lineno,
39  bool inside, const QString& src,
40  TraceLine* line = 0);
41 
42  // for call lines
43  SourceItem(SourceView* sv, QTreeWidgetItem* parent,
44  int fileno, unsigned int lineno,
45  TraceLine* line, TraceLineCall* lineCall);
46 
47  // for jump lines
48  SourceItem(SourceView* sv, QTreeWidgetItem* parent,
49  int fileno, unsigned int lineno,
50  TraceLine* line, TraceLineJump* lineJump);
51 
52  uint lineno() const { return _lineno; }
53  int fileNumber() const { return _fileno; }
54  bool inside() const { return _inside; }
55  TraceLine* line() const { return _line; }
56  TraceLineCall* lineCall() const { return _lineCall; }
57  TraceLineJump* lineJump() const { return _lineJump; }
58  TraceLineJump* jump(int i) const { return _jump[i]; }
59  int jumpCount() const { return _jump.size(); }
60  bool operator< ( const QTreeWidgetItem & other ) const;
61 
62  void updateGroup();
63  void updateCost();
64 
65  // arrow lines
66  void setJumpArray(const QVector<TraceLineJump*>& a);
67 
68  QVector<TraceLineJump*> _jump;
69 
70 private:
71  SourceView* _view;
72  SubCost _pure, _pure2;
73  uint _lineno;
74  int _fileno; // for line sorting (even with multiple files)
75  bool _inside;
76  TraceLine* _line;
77  TraceLineJump* _lineJump;
78  TraceLineCall* _lineCall;
79 };
80 
81 
82 // Delegate for drawing the arrows column
83 
84 class SourceItemDelegate : public QItemDelegate
85 {
86 public:
87  SourceItemDelegate(SourceView *parent);
88  void paint(QPainter *painter, const QStyleOptionViewItem &option,
89  const QModelIndex & index ) const;
90  QSize sizeHint(const QStyleOptionViewItem &option,
91  const QModelIndex &index) const;
92 
93 protected:
94  void paintArrows(QPainter *p,
95  const QStyleOptionViewItem &option,
96  const QModelIndex &index) const;
97 
98  SourceView* _parent;
99 };
100 
101 
102 #endif // SOURCEITEM_H
SourceItemDelegate::paintArrows
void paintArrows(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: sourceitem.cpp:343
SourceItem::SourceItem
SourceItem(SourceView *sv, QTreeWidget *parent, int fileno, unsigned int lineno, bool inside, const QString &src, TraceLine *line=0)
Definition: sourceitem.cpp:41
QTreeWidget
SourceItem::updateCost
void updateCost()
Definition: sourceitem.cpp:161
SourceItem::lineno
uint lineno() const
Definition: sourceitem.h:52
TraceLineCall
A call from a line of one function to another function.
Definition: tracedata.h:808
SourceItem::jumpCount
int jumpCount() const
Definition: sourceitem.h:59
SourceItem::setJumpArray
void setJumpArray(const QVector< TraceLineJump * > &a)
Definition: sourceitem.cpp:288
tracedata.h
SourceItem::inside
bool inside() const
Definition: sourceitem.h:54
SourceItem::jump
TraceLineJump * jump(int i) const
Definition: sourceitem.h:58
SourceItemDelegate::sizeHint
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: sourceitem.cpp:304
TraceLine
A source line of the program.
Definition: tracedata.h:935
SourceItem::updateGroup
void updateGroup()
Definition: sourceitem.cpp:152
SourceItem::_jump
QVector< TraceLineJump * > _jump
Definition: sourceitem.h:68
QTreeWidgetItem
SourceView
Definition: sourceview.h:31
SourceItem::lineCall
TraceLineCall * lineCall() const
Definition: sourceitem.h:56
SourceItemDelegate::SourceItemDelegate
SourceItemDelegate(SourceView *parent)
Definition: sourceitem.cpp:299
QItemDelegate
SourceItem::operator<
bool operator<(const QTreeWidgetItem &other) const
Definition: sourceitem.cpp:240
SubCost
Cost event counter, simple wrapper around a 64bit entity.
Definition: subcost.h:32
SourceItem::lineJump
TraceLineJump * lineJump() const
Definition: sourceitem.h:57
SourceItemDelegate::paint
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: sourceitem.cpp:322
TraceLineJump
A jump from one line to another inside of a function.
Definition: tracedata.h:754
SourceItemDelegate
Definition: sourceitem.h:84
SourceItem
Definition: sourceitem.h:33
SourceItemDelegate::_parent
SourceView * _parent
Definition: sourceitem.h:98
SourceItem::fileNumber
int fileNumber() const
Definition: sourceitem.h:53
SourceItem::line
TraceLine * line() const
Definition: sourceitem.h:55
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:03:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kcachegrind

Skip menu "kcachegrind"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal