QFluentWidgets.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef QFLUENTWIDGETS_H
  2. #define QFLUENTWIDGETS_H
  3. #include <QObject>
  4. #include "Common/Theme.h"
  5. #include "Common/StyleSheet.h"
  6. #include "Common/Config.h"
  7. /**
  8. * @brief 库style,theme管理,单例
  9. */
  10. class QFluentWidgets : public QObject
  11. {
  12. Q_OBJECT
  13. Q_DISABLE_COPY(QFluentWidgets)
  14. QFluentWidgets(QFluentWidgets &&) = delete;
  15. QFluentWidgets &operator=(QFluentWidgets &&) = delete;
  16. public:
  17. static QFluentWidgets &ins()
  18. {
  19. static QFluentWidgets single;
  20. return single;
  21. }
  22. void setConfigPath(const QString &path);
  23. /************************** theme start **************************/
  24. Qfw::Theme theme() const;
  25. QString themeName() const;
  26. void setTheme(const Qfw::Theme &theme);
  27. QColor themeColor() const;
  28. void setThemeColor(const QColor &themeColor);
  29. bool isDarkTheme();
  30. /************************** theme end **************************/
  31. signals:
  32. void appRestartSig();
  33. void themeChanged(Qfw::Theme t);
  34. void themeColorChanged(const QColor &);
  35. private:
  36. QFluentWidgets();
  37. Qfw::Theme m_theme;
  38. QColor m_themeColor;
  39. QScopedPointer<Qfw::QConfig> m_config;
  40. };
  41. #define QFWIns (QFluentWidgets::ins())
  42. #endif // QFLUENTWIDGETS_H