FluentUI/example/T_Theme.qml

62 lines
1.7 KiB
QML
Raw Normal View History

2023-03-30 21:52:55 +08:00
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import QtQuick.Controls
import FluentUI
2023-03-06 12:09:06 +08:00
2023-03-10 18:08:32 +08:00
FluScrollablePage{
title:"Theme"
2023-03-28 17:53:46 +08:00
leftPadding:10
rightPadding:10
bottomPadding:20
2023-03-10 18:08:32 +08:00
RowLayout{
Layout.topMargin: 20
Repeater{
model: [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
2023-03-27 18:24:35 +08:00
delegate: FluRectangle{
2023-03-10 18:08:32 +08:00
width: 42
height: 42
2023-03-27 18:24:35 +08:00
radius: [4,4,4,4]
2023-03-10 18:08:32 +08:00
color: mouse_item.containsMouse ? Qt.lighter(modelData.normal,1.1) : modelData.normal
FluIcon {
anchors.centerIn: parent
2023-03-12 21:49:11 +08:00
iconSource: FluentIcons.AcceptMedium
2023-03-10 18:08:32 +08:00
iconSize: 15
visible: modelData === FluTheme.primaryColor
2023-03-28 21:37:10 +08:00
color: FluTheme.dark ? 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{
2023-03-28 21:37:10 +08:00
selected: FluTheme.dark
2023-03-12 22:36:31 +08:00
clickFunc:function(){
2023-03-28 21:37:10 +08:00
FluTheme.dark = !FluTheme.dark
2023-03-10 18:08:32 +08:00
}
}
2023-03-11 21:15:36 +08:00
FluText{
text:"native文本渲染"
Layout.topMargin: 20
}
FluToggleSwitch{
2023-03-28 21:37:10 +08:00
selected: FluTheme.nativeText
2023-03-12 22:36:31 +08:00
clickFunc:function(){
2023-03-28 21:37:10 +08:00
FluTheme.nativeText = !FluTheme.nativeText
2023-03-11 21:15:36 +08:00
}
}
2023-03-06 12:09:06 +08:00
}