HAL
content_widget.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 "gui/widget/widget.h"
29 
30 #include <QIcon>
31 #include <QList>
32 
33 class QShortcut;
34 class QVBoxLayout;
35 
36 namespace hal
37 {
38  class ContentAnchor;
39  class Toolbar;
40 
49  class ContentWidget : public Widget
50  {
51  Q_OBJECT
54 
55  public:
62  explicit ContentWidget(QString name, QWidget* parent = nullptr);
63 
70  virtual void setupToolbar(Toolbar* Toolbar);
71 
79 
85  void repolish();
86 
92  QString name();
93 
99  QIcon icon();
100 
106  void setAnchor(ContentAnchor* anchor);
107 
113  void setIcon(QIcon icon);
114 
121  void set_name(const QString& name);
122 
126 
133 
141 
145 
151  void setIconStyle(const QString& style);
152 
158  void setIconPath(const QString& path);
160 
161  Q_SIGNALS:
162 
166  void removed();
167 
171  void detached();
172 
176  void reattached();
177 
181  void opened();
182 
186  void closed();
187 
193  void name_changed(const QString& name);
194 
195  public Q_SLOTS:
196 
200  void remove();
201 
205  void detach();
206 
210  void reattach();
211 
215  void open();
216 
220  void close();
221 
229 
233  virtual void restoreFromProject() {;}
234 
235  private:
236  void closeEvent(QCloseEvent* event);
237 
238  QString mName;
239  QIcon mIcon;
240  ContentAnchor* mAnchor = nullptr;
241  int mIndexPriority = 0;
242 
243  QString mIconStyle;
244  QString mIconPath;
245 
246  protected:
251  };
252 }
An abstract class that provides the interface for specific anchors (see SplitterAnchor or TabWidget )...
Abstract class for Widgets within HAL's ContentArea.
virtual void setupToolbar(Toolbar *Toolbar)
QKeySequence mSearchKeysequence
virtual void restoreFromProject()
void set_name(const QString &name)
void setIconPath(const QString &path)
void setAnchor(ContentAnchor *anchor)
QShortcut * mSearchShortcut
void name_changed(const QString &name)
void setIconStyle(const QString &style)
void handleSearchKeysequenceChanged(QKeySequence seq)
ContentWidget(QString name, QWidget *parent=nullptr)
void setIcon(QIcon icon)
virtual QList< QShortcut * > createShortcuts()
QVBoxLayout * mContentLayout
Toolbar for all ContentFrames and ContentWidgets.
Definition: toolbar.h:39
A QWidget customized for hal.
Definition: widget.h:41
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
virtual bool event(QEvent *event) override
QStyle * style() const const