HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
comment_speech_bubble.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4 // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 
24 #pragma once
25 
26 #include <QGraphicsItem>
27 #include <QRectF>
28 #include "gui/gui_def.h"
29 
30 namespace hal {
31  class GraphContext;
32 
37  {
38  bool mHover;
39  QRectF mBubble;
40  QString mText;
41  Node mNode;
42  GraphContext* mContext;
43 
44  void paintText(QPainter *painter, int maxWidth);
45 
46  static const int sBubbleWidth = 75;
47  static const int sTextMargin = 4;
48  static const int sTextHeight = 27;
49  static const int sBubbleWidthExtension = 350;
50  protected:
51  void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
52  void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
53 
54  public:
55  CommentSpeechBubble(const QString& txt, const Node& nd, GraphContext* ctx);
56  QRectF boundingRect() const override;
57  QPainterPath shape() const override;
58  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
59  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
60  };
61 }
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
CommentSpeechBubble(const QString &txt, const Node &nd, GraphContext *ctx)
QPainterPath shape() const override
QRectF boundingRect() const override
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override
Logical container for modules, gates, and nets.
Definition: graph_context.h:55
The Node class object represents a module or a gate.
Definition: gui_def.h:61
Definition: defines.h:45