HAL
graphics_item.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) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
5 // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
6 // Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in all
16 // copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 // SOFTWARE.
25 
26 #pragma once
27 
28 #include "hal_core/defines.h"
29 
30 #include "gui/gui_def.h"
31 
32 #include <QColor>
33 #include <QStyle>
34 #include <QGraphicsItem>
35 
36 namespace hal
37 {
43  class GraphicsItem : public QGraphicsItem
44  {
45  public:
49  static void loadSettings();
50 
58  static void setLod(const qreal lod);
59 
66  GraphicsItem(const ItemType type, const u32 id);
67 
73  ItemType itemType() const;
74 
80  u32 id() const;
81 
87  void setHightlight(bool hl);
88 
89  protected:
93  static qreal sLod;
94 
99 
104 
114  QColor penColor(QStyle::State state, const QColor& colorHint=QColor()) const;
115 
121  QColor selectionColor() const;
122 
129  QColor groupingColor() const;
130 
134  ItemType mItemType; // USE QT ITEM TYPE SYSTEM INSTEAD ???
135 
139  bool mHighlight; // paint with hightlight color
140 
145 
150  };
151 }
Superclass for all graphic items used ins the GraphicsScene. It contains information about the underl...
Definition: graphics_item.h:44
static QColor sSelectionColor
Definition: graphics_item.h:98
QColor selectionColor() const
static QColor sHighlightColor
static void setLod(const qreal lod)
QColor penColor(QStyle::State state, const QColor &colorHint=QColor()) const
ItemType itemType() const
void setHightlight(bool hl)
GraphicsItem(const ItemType type, const u32 id)
QColor groupingColor() const
static qreal sLod
Definition: graphics_item.h:93
static void loadSettings()
ItemType
The ItemType enum provides the enum type to classify graphic items into Modules, Gates or Nets....
Definition: gui_def.h:45
quint32 u32
virtual int type() const const
typedef State