1 /* 2 This file is part of KCachegrind. 3 4 SPDX-FileCopyrightText: 2003-2016 Josef Weidendorfer <Josef.Weidendorfer@gmx.de> 5 6 SPDX-License-Identifier: GPL-2.0-only 7 */ 8 9 /* 10 * Source View 11 */ 12 13 #ifndef SOURCEVIEW_H 14 #define SOURCEVIEW_H 15 16 #include <QTreeWidget> 17 #include "traceitemview.h" 18 19 class SourceItem; 20 21 class SourceView : public QTreeWidget, public TraceItemView 22 { 23 friend class SourceItem; 24 25 Q_OBJECT 26 27 public: 28 explicit SourceView(TraceItemView* parentView, 29 QWidget* parent = nullptr); 30 widget()31 QWidget* widget() override { return this; } 32 QString whatsThis() const override; arrowLevels()33 int arrowLevels() { return _arrowLevels; } 34 35 protected Q_SLOTS: 36 void context(const QPoint &); 37 void selectedSlot(QTreeWidgetItem*, QTreeWidgetItem*); 38 void activatedSlot(QTreeWidgetItem*,int); 39 void headerClicked(int); 40 41 protected: 42 void keyPressEvent(QKeyEvent* event) override; 43 44 private: 45 CostItem* canShow(CostItem*) override; 46 void doUpdate(int, bool) override; 47 void refresh(); 48 void updateJumpArray(uint,SourceItem*,bool,bool); 49 bool searchFile(QString&, TraceFunctionSource*); 50 void fillSourceFile(TraceFunctionSource*, int); 51 52 bool _inSelectionUpdate; 53 54 // arrows 55 int _arrowLevels; 56 // temporary needed on creation... 57 QVector<TraceLineJump*> _jump; 58 TraceLineJumpList _lowList, _highList; 59 TraceLineJumpList::iterator _lowListIter, _highListIter; 60 }; 61 62 #endif 63