FluentUI/src/FluTheme.h

53 lines
1.1 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef FLUTHEME_H
#define FLUTHEME_H
#include <QObject>
#include <QtQml/qqml.h>
#include "FluColorSet.h"
#include "stdafx.h"
/**
* @brief The FluTheme class
*/
class FluTheme : public QObject
{
Q_OBJECT
/**
* @brief dark 改变窗口夜间样式只读属性可以通过darkMode切换
*/
Q_PROPERTY(bool dark READ dark NOTIFY darkChanged)
/**
* @brief primaryColor 主题颜色
*/
Q_PROPERTY_AUTO(FluColorSet*,primaryColor)
/**
* @brief frameless 是否是无边框窗口只支持windows部分电脑
*/
Q_PROPERTY_AUTO(bool,frameless);
/**
* @brief darkMode 夜间模式支持System=0、Light=1、Dark=2
*/
Q_PROPERTY_AUTO(int,darkMode);
/**
* @brief nativeText 本地渲染文本
*/
Q_PROPERTY_AUTO(bool,nativeText);
QML_NAMED_ELEMENT(FluTheme)
QML_SINGLETON
public:
explicit FluTheme(QObject *parent = nullptr);
bool dark();
Q_SIGNAL void darkChanged();
private:
bool _dark;
bool eventFilter(QObject *obj, QEvent *event);
bool systemDark();
};
#endif // FLUTHEME_H