partition_widget.h
Go to the documentation of this file.
1 // *****************************************************************************
2 //
3 // Copyright (c) 2015, Southwest Research Institute® (SwRI®)
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are met:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of Southwest Research Institute® (SwRI®) nor the
14 // names of its contributors may be used to endorse or promote products
15 // derived from this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL Southwest Research Institute® BE LIABLE
21 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27 // DAMAGE.
28 //
29 // *****************************************************************************
30 #ifndef SWRI_PROFILER_TOOLS_PARTITION_WIDGET_H_
31 #define SWRI_PROFILER_TOOLS_PARTITION_WIDGET_H_
32 
33 #include <QWidget>
34 #include <QColor>
35 #include <QRectF>
37 
38 QT_BEGIN_NAMESPACE
39 class QHelpEvent;
40 QT_END_NAMESPACE
41 
42 namespace swri_profiler_tools
43 {
44 class Profile;
45 class ProfileDatabase;
46 class VariantAnimation;
47 class PartitionWidget : public QWidget
48 {
49  Q_OBJECT;
50 
51  public:
52  PartitionWidget(QWidget *parent=0);
54  void setDatabase(ProfileDatabase *db);
55 
56  public Q_SLOTS:
57  void setActiveNode(int profile_key, int node_key);
58 
59  Q_SIGNALS:
60  void activeNodeChanged(int profile_key, int node_key);
61 
62 
63  private:
64  // This structure stores information about how profile nodes are
65  // laid out.
66  struct LayoutItem
67  {
68  int node_key;
69  bool exclusive;
70  QRectF rect;
71  };
72  typedef std::vector<LayoutItem> Layout;
73 
76 
77  // Controls animation of the rect that defines the view area in the
78  // data space.
80  QTransform win_from_data_;
81 
83  Layout layoutProfile(const Profile &profile);
84 
85  void renderLayout(QPainter &painter,
86  const QTransform &win_from_rect,
87  const Layout &layout,
88  const Profile &profile);
89 
90  QTransform getTransform(const QRectF &win_rect,
91  const QRectF &data_rect);
92 
93  QRectF dataRect(const Layout &layout) const;
94 
95  int itemAtPoint(const QPointF &point) const;
96 
97  private Q_SLOTS:
98  void updateData();
99 
100  protected:
101  bool event(QEvent *event);
102  void toolTipEvent(QHelpEvent *event);
103  void paintEvent(QPaintEvent *event);
104  void mousePressEvent(QMouseEvent *event);
105  void mouseDoubleClickEvent(QMouseEvent *event);
106 }; // class PartitionWidget
107 } // namespace swri_profiler_tools
108 #endif // SWRI_PROFILER_TOOLS_PARTITION_WIDGET_H_
109 
void activeNodeChanged(int profile_key, int node_key)
void setDatabase(ProfileDatabase *db)
void setActiveNode(int profile_key, int node_key)
void renderLayout(QPainter &painter, const QTransform &win_from_rect, const Layout &layout, const Profile &profile)
void mousePressEvent(QMouseEvent *event)
Layout layoutProfile(const Profile &profile)
std::vector< LayoutItem > Layout
int itemAtPoint(const QPointF &point) const
void mouseDoubleClickEvent(QMouseEvent *event)
QTransform getTransform(const QRectF &win_rect, const QRectF &data_rect)
QRectF dataRect(const Layout &layout) const


swri_profiler_tools
Author(s):
autogenerated on Fri Nov 27 2020 03:44:18