diff --git a/src/FluGlobal.cpp b/src/FluGlobal.cpp index 52d31b11..5d686d45 100644 --- a/src/FluGlobal.cpp +++ b/src/FluGlobal.cpp @@ -18,7 +18,7 @@ void postInit(){ qDebug()<<"postInit"; FramelessHelper::Core::setApplicationOSThemeAware(); FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow); - FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial); +// FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial); } void initEngine(QQmlApplicationEngine* engine){ qDebug()<<"initEngine"; diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index e59ec16e..c2b4e1bd 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -1,3 +1,37 @@ +//#include "FluTheme.h" + +//#include "Def.h" +//#include "FluColors.h" +//#include +//#include +//#include +//#include +//#include +//#include + +//FRAMELESSHELPER_USE_NAMESPACE; + +//FluTheme* FluTheme::m_instance = nullptr; + +//FluTheme *FluTheme::getInstance() +//{ +// if(FluTheme::m_instance == nullptr){ +// FluTheme::m_instance = new FluTheme; +// } +// return FluTheme::m_instance; +//} + +//FluTheme::FluTheme(QObject *parent) +// : QObject{parent} +//{ +// primaryColor(FluColors::getInstance()->Blue()); +// nativeText(false); +// dark(FramelessManager::instance()->systemTheme() == Global::SystemTheme::Dark); +// connect(FramelessManager::instance(), &FramelessManager::systemThemeChanged, this, [this](){ +// dark(Utils::getSystemTheme()==Global::SystemTheme::Dark); +// }); +//} + #include "FluTheme.h" #include "Def.h" @@ -6,6 +40,11 @@ #include #include #include +#include +#include + +FRAMELESSHELPER_USE_NAMESPACE; + FluTheme* FluTheme::m_instance = nullptr; @@ -43,12 +82,10 @@ bool FluTheme::eventFilter(QObject *obj, QEvent *event) return false; } + bool FluTheme::systemDark() { - if (const QPlatformTheme * const theme = QGuiApplicationPrivate::platformTheme()) { - return (theme->appearance() == QPlatformTheme::Appearance::Dark); - } - return false; + return Utils::getSystemTheme()==Global::SystemTheme::Dark; } bool FluTheme::dark(){ diff --git a/src/imports/FluentUI/Controls/FluAppBar.qml b/src/imports/FluentUI/Controls/FluAppBar.qml index 27fb70a5..da6f7403 100644 --- a/src/imports/FluentUI/Controls/FluAppBar.qml +++ b/src/imports/FluentUI/Controls/FluAppBar.qml @@ -23,7 +23,17 @@ Rectangle{ property bool isMac: FluTools.isMacos() property color borerlessColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark id:root - color: Qt.rgba(0,0,0,0) + color: { + if(active){ + return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1) + } + return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) + } + Behavior on color{ + ColorAnimation { + duration: 300 + } + } height: visible ? 30 : 0 opacity: visible z: 65535 diff --git a/src/imports/FluentUI/Controls/FluNavigationView.qml b/src/imports/FluentUI/Controls/FluNavigationView.qml index d897101d..c268692f 100644 --- a/src/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/imports/FluentUI/Controls/FluNavigationView.qml @@ -623,15 +623,7 @@ Item { if(d.isMinimal || d.isCompactAndPanel){ return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(243/255,243/255,243/255,1) } - if(Window.window.active){ - return FluTheme.dark ? Qt.rgba(26/255,34/255,41/255,1) : Qt.rgba(238/255,244/255,249/255,1) - } - return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) - } - Behavior on color{ - ColorAnimation { - duration: 300 - } + return "transparent" } x: { if(d.displayMode !== FluNavigationView.Minimal) diff --git a/src/imports/FluentUI/Controls/FluWindow.qml b/src/imports/FluentUI/Controls/FluWindow.qml index 6970098f..09d5fd86 100644 --- a/src/imports/FluentUI/Controls/FluWindow.qml +++ b/src/imports/FluentUI/Controls/FluWindow.qml @@ -1,6 +1,7 @@ import QtQuick import QtQuick.Window import QtQuick.Controls +import QtQuick.Controls.Basic import QtQuick.Layouts import FluentUI import org.wangwenx190.FramelessHelper @@ -28,15 +29,15 @@ Window { event.accepted = false } } - property color backgroundColor: { - if(active){ - return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1) - } - return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) - } signal initArgument(var argument) id:window - color:"transparent" + property color backgroundColor: { + if(active){ + return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1) + } + return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) + } + color: "transparent" onClosing:(event)=>closeFunc(event) Component.onCompleted: { helper.initWindow(window) @@ -45,6 +46,7 @@ Window { Rectangle{ anchors.fill: parent color: backgroundColor + visible: FluTheme.darkMode !== FluDarkMode.System Behavior on color{ ColorAnimation { duration: 300