FluentUI/src/controls/FluTextBoxBackground.qml

47 lines
1.3 KiB
QML
Raw Normal View History

2023-03-02 12:20:16 +08:00
import QtQuick 2.15
import QtGraphicalEffects 1.15
Rectangle{
id:content
property Item inputItem
radius: 4
layer.enabled: true
color: {
2023-03-09 23:11:59 +08:00
if(input.focus){
return FluTheme.isDark ? Qt.rgba(36/255,36/255,36/255,1) : Qt.rgba(1,1,1,1)
}
2023-03-02 12:20:16 +08:00
if(input.hovered){
2023-03-06 14:22:13 +08:00
return FluTheme.isDark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
2023-03-02 12:20:16 +08:00
}
2023-03-06 14:22:13 +08:00
return FluTheme.isDark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
2023-03-02 12:20:16 +08:00
}
layer.effect:OpacityMask {
maskSource: Rectangle {
width: content.width
height: content.height
radius: 4
}
}
border.width: 1
2023-03-06 14:22:13 +08:00
border.color: FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(238/255,238/255,238/255,1)
2023-03-02 12:20:16 +08:00
Rectangle{
width: parent.width
height: input.focus ? 3 : 1
anchors.bottom: parent.bottom
color: {
2023-03-06 14:22:13 +08:00
if(FluTheme.isDark){
2023-03-06 12:09:06 +08:00
input.focus ? FluTheme.primaryColor.lighter : Qt.rgba(166/255,166/255,166/255,1)
2023-03-02 12:20:16 +08:00
}else{
2023-03-06 12:09:06 +08:00
return input.focus ? FluTheme.primaryColor.dark : Qt.rgba(183/255,183/255,183/255,1)
2023-03-02 12:20:16 +08:00
}
}
Behavior on height{
NumberAnimation{
duration: 200
}
}
}
}