HAL
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 
34  {
35  bool mHover;
36  QRectF mBubble;
37  QString mText;
38  Node mNode;
39  GraphContext* mContext;
40 
41  void paintText(QPainter *painter, int maxWidth);
42 
43  static const int sBubbleWidth = 75;
44  static const int sTextMargin = 4;
45  static const int sTextHeight = 27;
46  static const int sBubbleWidthExtension = 350;
47  protected:
48  void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
49  void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
50 
51  public:
52  CommentSpeechBubble(const QString& txt, const Node& nd, GraphContext* ctx);
53  QRectF boundingRect() const override;
54  QPainterPath shape() const override;
55  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
56  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
57  };
58 }
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
option(PL_GUI "PL_GUI" ON) if(PL_GUI OR BUILD_ALL_PLUGINS) cmake_minimum_required(VERSION 3.1.0) if(APPLE AND CMAKE_HOST_APPLE AND NOT Qt5_DIR) set(Qt5_DIR "/usr/local/opt/qt@5/lib/cmake") endif(APPLE AND CMAKE_HOST_APPLE AND NOT Qt5_DIR) find_package(Qt5 COMPONENTS Core REQUIRED) find_package(Qt5 COMPONENTS Widgets REQUIRED) if(Qt5Widgets_FOUND) message(VERBOSE "Qt5Widgets_INCLUDE_DIRS
Definition: CMakeLists.txt:1