FluentUI/example/T_Theme.qml

70 lines
1.9 KiB
QML
Raw Normal View History

2023-03-06 12:09:06 +08:00
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
2023-03-06 18:08:01 +08:00
import QtQuick.Controls 2.15
2023-03-06 12:09:06 +08:00
import QtGraphicalEffects 1.15
import FluentUI 1.0
2023-03-10 18:08:32 +08:00
FluScrollablePage{
title:"Theme"
RowLayout{
Layout.topMargin: 20
Repeater{
model: [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
delegate: Rectangle{
width: 42
height: 42
radius: 4
color: mouse_item.containsMouse ? Qt.lighter(modelData.normal,1.1) : modelData.normal
FluIcon {
anchors.centerIn: parent
2023-03-11 00:29:06 +08:00
icon: FluentIcons.AcceptMedium
2023-03-10 18:08:32 +08:00
iconSize: 15
visible: modelData === FluTheme.primaryColor
color: FluTheme.isDark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
2023-03-06 18:22:36 +08:00
}
2023-03-10 18:08:32 +08:00
MouseArea{
id:mouse_item
anchors.fill: parent
hoverEnabled: true
onClicked: {
FluTheme.primaryColor = modelData
}
2023-03-09 11:50:40 +08:00
}
}
2023-03-06 12:09:06 +08:00
}
}
2023-03-10 18:08:32 +08:00
FluText{
text:"夜间模式"
Layout.topMargin: 20
}
FluToggleSwitch{
checked: FluTheme.isDark
onClickFunc:function(){
FluTheme.isDark = !FluTheme.isDark
}
}
FluText{
text:"无边框"
Layout.topMargin: 20
}
FluToggleSwitch{
checked: FluTheme.isFrameless
onClickFunc:function(){
FluTheme.isFrameless = !FluTheme.isFrameless
}
}
2023-03-11 21:15:36 +08:00
FluText{
text:"native文本渲染"
Layout.topMargin: 20
}
FluToggleSwitch{
checked: FluTheme.isNativeText
onClickFunc:function(){
FluTheme.isNativeText = !FluTheme.isNativeText
}
}
2023-03-06 12:09:06 +08:00
}