FluTextBoxBackground.qml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import QtQuick
  2. import QtQuick.Controls
  3. import Qt5Compat.GraphicalEffects
  4. import FluentUI
  5. Rectangle{
  6. property Item inputItem
  7. id:content
  8. radius: 4
  9. layer.enabled: true
  10. color: {
  11. if(inputItem.disabled){
  12. return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
  13. }
  14. if(inputItem.focus){
  15. return FluTheme.dark ? Qt.rgba(36/255,36/255,36/255,1) : Qt.rgba(1,1,1,1)
  16. }
  17. if(inputItem.hovered){
  18. return FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
  19. }
  20. return FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
  21. }
  22. layer.effect:OpacityMask {
  23. maskSource: Rectangle {
  24. width: content.width
  25. height: content.height
  26. radius: 4
  27. }
  28. }
  29. border.width: 1
  30. border.color: {
  31. if(inputItem.disabled){
  32. return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(237/255,237/255,237/255,1)
  33. }
  34. return FluTheme.dark ? Qt.rgba(76/255,76/255,76/255,1) : Qt.rgba(240/255,240/255,240/255,1)
  35. }
  36. Rectangle{
  37. width: parent.width
  38. height: inputItem.focus ? 3 : 1
  39. anchors.bottom: parent.bottom
  40. visible: !inputItem.disabled
  41. color: {
  42. if(FluTheme.dark){
  43. inputItem.focus ? FluTheme.primaryColor.lighter : Qt.rgba(166/255,166/255,166/255,1)
  44. }else{
  45. return inputItem.focus ? FluTheme.primaryColor.dark : Qt.rgba(183/255,183/255,183/255,1)
  46. }
  47. }
  48. Behavior on height{
  49. NumberAnimation{
  50. duration: 167
  51. easing.type: Easing.BezierSpline
  52. easing.bezierCurve: [ 1, 0, 0, 0 ]
  53. }
  54. }
  55. }
  56. }