This commit is contained in:
朱子楚\zhuzi 2023-05-18 22:58:35 +08:00
parent 0003f8192e
commit 9adc63b3bc
5 changed files with 63 additions and 22 deletions

View File

@ -18,7 +18,7 @@ void postInit(){
qDebug()<<"postInit"; qDebug()<<"postInit";
FramelessHelper::Core::setApplicationOSThemeAware(); FramelessHelper::Core::setApplicationOSThemeAware();
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow); FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial); // FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial);
} }
void initEngine(QQmlApplicationEngine* engine){ void initEngine(QQmlApplicationEngine* engine){
qDebug()<<"initEngine"; qDebug()<<"initEngine";

View File

@ -1,3 +1,37 @@
//#include "FluTheme.h"
//#include "Def.h"
//#include "FluColors.h"
//#include <QPalette>
//#include <QtGui/qpa/qplatformtheme.h>
//#include <QtGui/private/qguiapplication_p.h>
//#include <QGuiApplication>
//#include <FramelessHelper/Core/utils.h>
//#include <FramelessHelper/Core/framelessmanager.h>
//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 "FluTheme.h"
#include "Def.h" #include "Def.h"
@ -6,6 +40,11 @@
#include <QtGui/qpa/qplatformtheme.h> #include <QtGui/qpa/qplatformtheme.h>
#include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qguiapplication_p.h>
#include <QGuiApplication> #include <QGuiApplication>
#include <FramelessHelper/Core/utils.h>
#include <FramelessHelper/Core/framelessmanager.h>
FRAMELESSHELPER_USE_NAMESPACE;
FluTheme* FluTheme::m_instance = nullptr; FluTheme* FluTheme::m_instance = nullptr;
@ -43,12 +82,10 @@ bool FluTheme::eventFilter(QObject *obj, QEvent *event)
return false; return false;
} }
bool FluTheme::systemDark() bool FluTheme::systemDark()
{ {
if (const QPlatformTheme * const theme = QGuiApplicationPrivate::platformTheme()) { return Utils::getSystemTheme()==Global::SystemTheme::Dark;
return (theme->appearance() == QPlatformTheme::Appearance::Dark);
}
return false;
} }
bool FluTheme::dark(){ bool FluTheme::dark(){

View File

@ -23,7 +23,17 @@ Rectangle{
property bool isMac: FluTools.isMacos() property bool isMac: FluTools.isMacos()
property color borerlessColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark property color borerlessColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
id:root 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 height: visible ? 30 : 0
opacity: visible opacity: visible
z: 65535 z: 65535

View File

@ -623,15 +623,7 @@ Item {
if(d.isMinimal || d.isCompactAndPanel){ 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) 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 "transparent"
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
}
} }
x: { x: {
if(d.displayMode !== FluNavigationView.Minimal) if(d.displayMode !== FluNavigationView.Minimal)

View File

@ -1,6 +1,7 @@
import QtQuick import QtQuick
import QtQuick.Window import QtQuick.Window
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts import QtQuick.Layouts
import FluentUI import FluentUI
import org.wangwenx190.FramelessHelper import org.wangwenx190.FramelessHelper
@ -28,14 +29,14 @@ Window {
event.accepted = false event.accepted = false
} }
} }
signal initArgument(var argument)
id:window
property color backgroundColor: { property color backgroundColor: {
if(active){ 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(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) 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" color: "transparent"
onClosing:(event)=>closeFunc(event) onClosing:(event)=>closeFunc(event)
Component.onCompleted: { Component.onCompleted: {
@ -45,6 +46,7 @@ Window {
Rectangle{ Rectangle{
anchors.fill: parent anchors.fill: parent
color: backgroundColor color: backgroundColor
visible: FluTheme.darkMode !== FluDarkMode.System
Behavior on color{ Behavior on color{
ColorAnimation { ColorAnimation {
duration: 300 duration: 300