Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
berryQtStyleManager.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #ifndef BERRYQTSTYLEMANAGER_H_
15 #define BERRYQTSTYLEMANAGER_H_
16 
17 #include <berryIQtStyleManager.h>
19 
20 #include <QHash>
21 
22 #include <typeinfo>
23 
24 namespace berry {
25 
26 class BERRY_UI_QT QtStyleManager : public QObject, public IQtStyleManager
27 {
28  Q_OBJECT
29  Q_INTERFACES(berry::IQtStyleManager)
30 
31 public:
32  static QIcon ThemeIcon(const QByteArray &originalSVG);
33  static QIcon ThemeIcon(const QString &resourcePath);
34 
36  ~QtStyleManager() override;
37 
38  Style GetStyle() const override;
39  QString GetStylesheet() const override;
40  QString GetActiveTabStylesheet() const override;
41  QString GetTabStylesheet() const override;
42  QString GetFont() const override;
43 
44  void AddStyle(const QString& styleFileName,
45  const QString& styleName = QString()) override;
46  void AddStyles(const QString& path) override;
47  void RemoveStyle(const QString& styleFileName) override;
48  void RemoveStyles(const QString& path = QString()) override;
49 
50  void GetStyles(StyleList& styles) const override;
51  void SetStyle(const QString& fileName) override;
52 
53  void GetFonts(QStringList& fontNames) const override;
54 
55  void SetFont(const QString& fontName) override;
56  void SetFontSize(const int fontSize) override;
57  void UpdateWorkbenchFont() override;
58 
59  Style GetDefaultStyle() const override;
60  void SetDefaultStyle() override;
61 
62  bool Contains(const QString& fileName) const override;
63 
64  bool IsA( const std::type_info& type ) const;
65  const std::type_info& GetType() const;
66 
67 private:
68 
69  void AddDefaultStyle();
70  void AddDefaultFonts();
71  void ClearStyles();
72  void ReadPreferences();
73 
74  struct ExtStyle : public Style
75  {
76  QString stylesheet;
77  QString tabStylesheet;
78  QString activeTabStylesheet;
79  };
80 
81  QStringList m_customFontNames;
82  void ReadStyleData(ExtStyle* style);
83 
84  typedef QHash<QString, ExtStyle*> FileNameToStyleMap;
85  FileNameToStyleMap styles;
86 
87  QString m_currentFont;
88  int m_currentFontSize;
89  ExtStyle const* currentStyle;
90  ExtStyle* defaultStyle;
91 
92 };
93 }
94 
95 #endif /* BERRYQTSTYLEMANAGER_H_ */
berry::IQtStyleManager
Definition: berryIQtStyleManager.h:25
org_blueberry_ui_qt_Export.h
berry::IQtStyleManager::StyleList
QList< Style > StyleList
Definition: berryIQtStyleManager.h:51
berryIQtStyleManager.h
berry::QtStyleManager
Definition: berryQtStyleManager.h:26
BERRY_UI_QT
#define BERRY_UI_QT
Definition: org_blueberry_ui_qt_Export.h:26
berry::IQtStyleManager::Style
Definition: berryIQtStyleManager.h:28
berry
Definition: QmitkPropertyItemModel.h:24