QFluentWidgets.cpp 907 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include "QFluentWidgets.h"
  2. #include <QApplication>
  3. #include <QTextCodec>
  4. QFluentWidgets::QFluentWidgets()
  5. {
  6. m_config.reset(new Qfw::QConfig(this));
  7. m_theme = m_config->theme();
  8. m_themeColor = m_config->themeColor();
  9. }
  10. void QFluentWidgets::setConfigPath(const QString &path)
  11. {
  12. m_config.reset(new Qfw::QConfig(path, this));
  13. m_theme = m_config->theme();
  14. m_themeColor = m_config->themeColor();
  15. }
  16. Qfw::Theme QFluentWidgets::theme() const
  17. {
  18. return m_theme;
  19. }
  20. QString QFluentWidgets::themeName() const
  21. {
  22. return Qfw::ThemeString(m_theme);
  23. }
  24. void QFluentWidgets::setTheme(const Qfw::Theme &theme)
  25. {
  26. m_theme = theme;
  27. }
  28. QColor QFluentWidgets::themeColor() const
  29. {
  30. return m_themeColor;
  31. }
  32. void QFluentWidgets::setThemeColor(const QColor &themeColor)
  33. {
  34. m_themeColor = themeColor;
  35. }
  36. bool QFluentWidgets::isDarkTheme()
  37. {
  38. return theme() == Qfw::DARK;
  39. }