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

kcachegrind

  • sources
  • kde-4.14
  • kdesdk
  • kcachegrind
  • libviews
tabview.h
Go to the documentation of this file.
1 /* This file is part of KCachegrind.
2  Copyright (C) 2003 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  * Tab View, enclosing detailed views for one trace item in
21  * two tab widgets, separated by a splitter
22  */
23 
24 #ifndef TABVIEW_H
25 #define TABVIEW_H
26 
27 #include <QWidget>
28 #include <QTabWidget>
29 #include <QTabBar>
30 #include <QMouseEvent>
31 #include <QHideEvent>
32 #include <QShowEvent>
33 #include <QMoveEvent>
34 #include <QResizeEvent>
35 #include <QEvent>
36 #include <QSplitter>
37 #include <QList>
38 
39 #include "traceitemview.h"
40 
41 class QLabel;
42 class TabView;
43 
47 class TabBar : public QTabBar
48 {
49  Q_OBJECT
50 
51  public:
52  TabBar(TabView*, QTabWidget* parent, const char *name = 0);
53  protected:
54  void mousePressEvent(QMouseEvent *e);
55 
56  private:
57  void context(QWidget*, const QPoint &);
58 
59  QTabWidget* _tabWidget;
60  TabView* _tabView;
61 };
62 
63 
70 class Splitter: public QSplitter
71 {
72  Q_OBJECT
73 
74 public:
75  explicit Splitter(Qt::Orientation o, QWidget* parent = 0);
76  void checkVisiblity();
77 
78 protected:
79  void moveEvent(QMoveEvent *);
80 };
81 
82 
89 class TabWidget: public QTabWidget
90 {
91  Q_OBJECT
92 
93 public:
94 
95  explicit TabWidget(TabView*, QWidget* parent = 0);
96 
97  bool hasVisibleRect() { return _hasVisibleRect; }
98  void checkVisibility();
99 
100 signals:
101  void visibleRectChanged(TabWidget*);
102 
103 protected:
104  void resizeEvent(QResizeEvent *);
105  void showEvent(QShowEvent *);
106  void hideEvent(QHideEvent *);
107  void moveEvent(QMoveEvent *);
108 
109 private:
110  bool _hasVisibleRect;
111 };
112 
113 
114 
115 class TabView : public QWidget, public TraceItemView
116 {
117  Q_OBJECT
118 
119 public:
120 
121  explicit TabView( TraceItemView* parentView,
122  QWidget* parent = 0 );
123 
124  virtual QWidget* widget() { return this; }
125  QString whatsThis() const;
126  void setData(TraceData*);
127  bool isViewVisible() { return !_isCollapsed; }
128  void selected(TraceItemView*, CostItem*);
129  bool active() const { return _active; }
130  void setActive(bool);
131 
136  void moveTab(QWidget* w, Position, bool wholeArea = false);
137 
138  Position tabPosition(QWidget*);
139  int visibleTabs();
140  int visibleAreas();
141 
142  void saveLayout(const QString& prefix, const QString& postfix);
143  void restoreLayout(const QString& prefix, const QString& postfix);
144  void saveOptions(const QString& prefix, const QString& postfix);
145  void restoreOptions(const QString& prefix, const QString& postfix);
146 
147 public slots:
148  void tabChanged(int);
149  void visibleRectChangedSlot(TabWidget*);
150 
151 signals:
152  void tabActivated(TabView*);
153 
154 protected:
155  void resizeEvent(QResizeEvent *);
156  bool eventFilter(QObject*, QEvent*);
157  void mousePressEvent(QMouseEvent*);
158 
159 private:
160  TraceItemView* addTab(const QString&, TraceItemView*);
161  void addTop(TraceItemView*);
162  void addBottom(TraceItemView*);
163  TabWidget* tabWidget(Position);
164  void updateVisibility();
165  void doUpdate(int, bool);
166  void updateNameLabel(QString n = QString::null);
167  void installFocusFilters();
168  void tabCounts(int&, int&, int&, int&);
169 
170  // this is true if width or height <= 1, and no child updates are done
171  bool _isCollapsed;
172 
173  QLabel* _nameLabel;
174  QString _nameLabelText, _nameLabelTooltip;
175  int _textWidth;
176 
177  QSplitter *_mainSplitter, *_leftSplitter, *_bottomSplitter;
178  TabWidget *_topTW, *_leftTW, *_bottomTW, *_rightTW;
179  QList<TraceItemView*> _tabs;
180 
181  QWidget* _lastFocus;
182  bool _active;
183 };
184 
185 #endif
QHideEvent
TabView::selected
void selected(TraceItemView *, CostItem *)
Notification from child views.
Definition: tabview.cpp:811
TabWidget::visibleRectChanged
void visibleRectChanged(TabWidget *)
TabView::TabView
TabView(TraceItemView *parentView, QWidget *parent=0)
Definition: tabview.cpp:304
QEvent
QResizeEvent
QWidget
TabWidget
Own TabView:
Definition: tabview.h:89
QMoveEvent
TabWidget::hideEvent
void hideEvent(QHideEvent *)
Definition: tabview.cpp:264
TabView::resizeEvent
void resizeEvent(QResizeEvent *)
Definition: tabview.cpp:794
TabWidget::moveEvent
void moveEvent(QMoveEvent *)
Definition: tabview.cpp:272
Splitter::checkVisiblity
void checkVisiblity()
Definition: tabview.cpp:200
TraceItemView::Position
Position
Definition: traceitemview.h:93
TabView::eventFilter
bool eventFilter(QObject *, QEvent *)
Definition: tabview.cpp:692
TabWidget::showEvent
void showEvent(QShowEvent *)
Definition: tabview.cpp:256
TabView::setData
void setData(TraceData *)
Definition: tabview.cpp:435
TabWidget::hasVisibleRect
bool hasVisibleRect()
Definition: tabview.h:97
CostItem
Base class for cost items.
Definition: costitem.h:37
traceitemview.h
QPoint
QMouseEvent
QTabWidget
TabView::widget
virtual QWidget * widget()
Definition: tabview.h:124
TraceItemView
Abstract Base Class for KCachegrind Views.
Definition: traceitemview.h:70
TabWidget::checkVisibility
void checkVisibility()
Definition: tabview.cpp:228
QObject::name
const char * name() const
TabView::moveTab
void moveTab(QWidget *w, Position, bool wholeArea=false)
Rearrange tabs if == 0, move hidden tabs.
Definition: tabview.cpp:600
Splitter::moveEvent
void moveEvent(QMoveEvent *)
Definition: tabview.cpp:192
TabView::visibleRectChangedSlot
void visibleRectChangedSlot(TabWidget *)
Definition: tabview.cpp:785
QShowEvent
QObject
TabView::visibleTabs
int visibleTabs()
Definition: tabview.cpp:470
TabView::tabActivated
void tabActivated(TabView *)
QString
QList< TraceItemView * >
TabView::tabPosition
Position tabPosition(QWidget *)
Definition: tabview.cpp:462
TabView::restoreOptions
void restoreOptions(const QString &prefix, const QString &postfix)
Definition: tabview.cpp:984
QTabBar
TabBar::TabBar
TabBar(TabView *, QTabWidget *parent, const char *name=0)
Definition: tabview.cpp:70
TabWidget::TabWidget
TabWidget(TabView *, QWidget *parent=0)
Definition: tabview.cpp:221
TabView::whatsThis
QString whatsThis() const
Definition: tabview.cpp:652
QSplitter
TabView::setActive
void setActive(bool)
Definition: tabview.cpp:708
Splitter::Splitter
Splitter(Qt::Orientation o, QWidget *parent=0)
Definition: tabview.cpp:188
TabView::restoreLayout
void restoreLayout(const QString &prefix, const QString &postfix)
Definition: tabview.cpp:820
TabView::saveLayout
void saveLayout(const QString &prefix, const QString &postfix)
Definition: tabview.cpp:903
TabBar::mousePressEvent
void mousePressEvent(QMouseEvent *e)
Definition: tabview.cpp:78
TabBar
Subclass of QTabBar to enable context menu on tabs.
Definition: tabview.h:47
TabView::visibleAreas
int visibleAreas()
Definition: tabview.cpp:509
TabView::saveOptions
void saveOptions(const QString &prefix, const QString &postfix)
Definition: tabview.cpp:1017
TabWidget::resizeEvent
void resizeEvent(QResizeEvent *)
Definition: tabview.cpp:246
TabView::tabChanged
void tabChanged(int)
Definition: tabview.cpp:775
TabView::mousePressEvent
void mousePressEvent(QMouseEvent *)
Definition: tabview.cpp:701
TabView
Definition: tabview.h:115
TraceData
This class holds profiling data of multiple tracefiles generated with cachegrind on one command...
Definition: tracedata.h:1363
TabView::isViewVisible
bool isViewVisible()
Definition: tabview.h:127
QLabel
QObject::parent
QObject * parent() const
TabView::active
bool active() const
Definition: tabview.h:129
Splitter
Own Splitter: Call checkVisiblity for all TabWidget children of the splitter on a MoveEvent...
Definition: tabview.h:70
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:39:50 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
  • 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