swift
settingsfontcomponent.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_COMPONENTS_SETTINGSFONTCOMPONENT_H
7 #define SWIFT_GUI_COMPONENTS_SETTINGSFONTCOMPONENT_H
8 
9 #include <QFrame>
10 
11 namespace Ui
12 {
13  class CSettingsFontComponent;
14 }
15 namespace swift::gui::components
16 {
20  class CSettingsFontComponent : public QFrame
21  {
22  Q_OBJECT
23 
24  public:
26  enum Mode
27  {
30  };
31 
33  explicit CSettingsFontComponent(QWidget *parent = nullptr);
34 
36  virtual ~CSettingsFontComponent() override;
37 
39  void setMode(Mode m);
40 
42  const QString &getQss() const { return m_qss; }
43 
45  void setFont(const QFont &font);
46 
48  QFont getFont() const;
49 
51  QStringList getFamilySizeStyle() const;
52 
54  void setWithColorSelection(bool withColor);
55 
58 
59  signals:
61  void accept();
62 
64  void reject();
65 
66  private:
67  QScopedPointer<Ui::CSettingsFontComponent> ui;
68  QColor m_selectedColor;
69  QColor m_cancelColor;
70  QFont m_cancelFont;
71  QString m_qss;
72  bool m_noColorDefault = true;
73  Mode m_mode = DirectUpdate;
74 
75  void changeFont();
76  void resetFont();
77  void resetFontAndReject();
78  void clearQssAndResetFont();
79  void fontColorDialog();
80  void noColor();
81  void initValues();
82  void initUiValues(const QFont &font, const QColor &color);
83  };
84 } // namespace swift::gui::components
85 
86 #endif // SWIFT_GUI_COMPONENTS_SETTINGSFONTCOMPONENT_H
CSettingsFontComponent(QWidget *parent=nullptr)
Constructor.
void reject()
To be used with dialogs.
void setFont(const QFont &font)
Set the current font.
const QString & getQss() const
Get the stylesheet.
void accept()
To be used with dialogs.
void setWithColorSelection(bool withColor)
With color selection.
QStringList getFamilySizeStyle() const
Strings such as.
@ DirectUpdate
directly updating a font qss file
void setStyleSheetDefaultColor()
Set the default color from style sheet.
High level reusable GUI components.
Definition: aboutdialog.cpp:13