HAL
graphics_qss_adapter.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 <QWidget>
29 
30 namespace hal
31 {
38  class GraphicsQssAdapter : public QWidget
39  {
40  Q_OBJECT
41 
44 
47 
51 
53 
56 
59 
62  public:
63 
64  void repolish();
65 
69  QColor gateBaseColor() const;
70  QColor netBaseColor() const;
71 
72  // GATE BACKGROUND COLOR
73  // GATE OUTLINE COLOR
74  // ...
75 
76  QColor gateSelectionColor() const;
77  QColor netSelectionColor() const;
78 
79  QFont gateNameFont() const;
80  QFont gateTypeFont() const;
81  QFont gatePinFont() const;
82 
83  QFont netFont() const;
84 
85  QColor gridBaseLineColor() const;
87 
88  QColor gridBaseDotColor() const;
90 
92  QColor nodeTextColor() const;
94 
98  void setGateBaseColor(const QColor& color);
99  void setNetBaseColor(const QColor& color);
100 
101  void setGateSelectionColor(const QColor& color);
102  void setNetSelectionColor(const QColor& color);
103 
104  void setGateNameFont(const QFont& font);
105  void setGateTypeFont(const QFont& font);
106  void setGatePinFont(const QFont& font);
107 
108  void setNetFont(const QFont& font);
109 
110  void setGridAlpha(int alpha);
111  void setGridAlphaF(qreal alpha);
118  void setGridBaseLineColor(const QColor& color);
119 
127  void setGridClusterLineColor(const QColor& color);
128 
134  void setGridBaseDotColor(const QColor& color);
135 
142  void setGridClusterDotColor(const QColor& color);
143 
144  void setNodeBackgroundColor(const QColor& color);
145  void setNodeTextColor(const QColor& color);
147 
152  static GraphicsQssAdapter* instance();
153  private:
154  explicit GraphicsQssAdapter(QWidget* parent = nullptr);
155  static GraphicsQssAdapter* inst;
156 
157  QColor mGateBaseColor;
158  QColor mNetBaseColor;
159 
160  QColor mGateSelectionColor;
161  QColor mNetSelectionColor;
162 
163  QFont mGateNameFont;
164  QFont mGateTypeFont;
165  QFont mGatePinFont;
166 
167  QFont mNetFont;
168 
169  QColor mGridBaseLineColor;
170  QColor mGridClusterLineColor;
171 
172  QColor mGridBaseDotColor;
173  QColor mGridClusterDotColor;
174 
175  QColor mNodeBackgroundColor;
176  QColor mNodeTextColor;
177  };
178 }
Connects the stylesheet properties with the code.
void setGridClusterLineColor(const QColor &color)
void setNetBaseColor(const QColor &color)
void setNodeBackgroundColor(const QColor &color)
void setGateNameFont(const QFont &font)
void setGateSelectionColor(const QColor &color)
void setNetFont(const QFont &font)
void setNetSelectionColor(const QColor &color)
void setGateBaseColor(const QColor &color)
void setGridClusterDotColor(const QColor &color)
static GraphicsQssAdapter * instance()
void setNodeTextColor(const QColor &color)
void setGridBaseLineColor(const QColor &color)
void setGateTypeFont(const QFont &font)
void setGridBaseDotColor(const QColor &color)
void setGatePinFont(const QFont &font)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QObject * parent() const const