Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
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 const QString DEFAULT_FONT;
33  static const int DEFAULT_FONT_SIZE;
34 
35  static QIcon ThemeIcon(const QByteArray &originalSVG);
36  static QIcon ThemeIcon(const QString &resourcePath);
37 
39  ~QtStyleManager() override;
40 
41  Style GetStyle() const override;
42  QString GetStylesheet() const override;
43  QString GetActiveTabStylesheet() const override;
44  QString GetTabStylesheet() const override;
45  QString GetFont() const override;
46 
47  void AddStyle(const QString& styleFileName,
48  const QString& styleName = QString()) override;
49  void AddStyles(const QString& path) override;
50  void RemoveStyle(const QString& styleFileName) override;
51  void RemoveStyles(const QString& path = QString()) override;
52 
53  void GetStyles(StyleList& styles) const override;
54  void SetStyle(const QString& fileName) override;
55 
56  void GetFonts(QStringList& fontNames) const override;
57 
58  void SetFont(const QString& fontName) override;
59  void SetFontSize(int fontSize) override;
60  void UpdateWorkbenchFont() override;
61 
62  Style GetDefaultStyle() const override;
63  void SetDefaultStyle() override;
64 
65  bool Contains(const QString& fileName) const override;
66 
67  bool IsA( const std::type_info& type ) const;
68  const std::type_info& GetType() const;
69 
70 private:
71 
72  void AddDefaultStyle();
73  void AddDefaultFonts();
74  void AddFontFamilies();
75  void UpdateWorkbenchStyleSheet() const;
76  void ClearStyles();
77  void ReadPreferences();
78 
79  struct ExtStyle : public Style
80  {
81  QString stylesheet;
82  QString tabStylesheet;
83  QString activeTabStylesheet;
84  };
85 
86  QStringList m_customFontNames;
87  void ReadStyleData(ExtStyle* style);
88 
89  typedef QHash<QString, ExtStyle*> FileNameToStyleMap;
90  FileNameToStyleMap styles;
91 
92  QString m_currentFont;
93  int m_currentFontSize;
94  ExtStyle const* currentStyle;
95  ExtStyle* defaultStyle;
96 
97 };
98 }
99 
100 #endif /* BERRYQTSTYLEMANAGER_H_ */
berry::IQtStyleManager
Definition: berryIQtStyleManager.h:25
org_blueberry_ui_qt_Export.h
berry::QtStyleManager::DEFAULT_FONT
static const QString DEFAULT_FONT
Definition: berryQtStyleManager.h:32
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::QtStyleManager::DEFAULT_FONT_SIZE
static const int DEFAULT_FONT_SIZE
Definition: berryQtStyleManager.h:33
berry
Definition: QmitkPropertyItemModel.h:24