Update TextField to match designs when disabled.

CURA-8991
This commit is contained in:
j.delarago 2022-03-04 13:39:50 +01:00
parent 1fc6b8ced6
commit fb42679d08
2 changed files with 18 additions and 9 deletions

View file

@ -1,4 +1,4 @@
// Copyright (c) 2021 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10 import QtQuick 2.10
@ -13,7 +13,7 @@ import Cura 1.1 as Cura
// //
TextField TextField
{ {
id: textField id: control
property alias leftIcon: iconLeft.source property alias leftIcon: iconLeft.source
@ -22,7 +22,7 @@ TextField
hoverEnabled: true hoverEnabled: true
selectByMouse: true selectByMouse: true
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text_field_text")
renderType: Text.NativeRendering renderType: Text.NativeRendering
selectionColor: UM.Theme.getColor("text_selection") selectionColor: UM.Theme.getColor("text_selection")
leftPadding: iconLeft.visible ? iconLeft.width + UM.Theme.getSize("default_margin").width * 2 : UM.Theme.getSize("thin_margin").width leftPadding: iconLeft.visible ? iconLeft.width + UM.Theme.getSize("default_margin").width * 2 : UM.Theme.getSize("thin_margin").width
@ -31,20 +31,21 @@ TextField
State State
{ {
name: "disabled" name: "disabled"
when: !textField.enabled when: !control.enabled
PropertyChanges { target: backgroundRectangle; color: UM.Theme.getColor("setting_control_disabled")} PropertyChanges { target: control; color: UM.Theme.getColor("text_field_text_disabled")}
PropertyChanges { target: backgroundRectangle; liningColor: UM.Theme.getColor("text_field_border_disabled")}
}, },
State State
{ {
name: "invalid" name: "invalid"
when: !textField.acceptableInput when: !control.acceptableInput
PropertyChanges { target: backgroundRectangle; color: UM.Theme.getColor("setting_validation_error_background")} PropertyChanges { target: backgroundRectangle; color: UM.Theme.getColor("setting_validation_error_background")}
}, },
State State
{ {
name: "hovered" name: "hovered"
when: textField.hovered || textField.activeFocus when: control.hovered || control.activeFocus
PropertyChanges { target: backgroundRectangle; liningColor: UM.Theme.getColor("border_main")} PropertyChanges { target: backgroundRectangle; liningColor: UM.Theme.getColor("text_field_border_hovered")}
} }
] ]
@ -66,7 +67,7 @@ TextField
visible: source != "" visible: source != ""
height: UM.Theme.getSize("small_button_icon").height height: UM.Theme.getSize("small_button_icon").height
width: visible ? height : 0 width: visible ? height : 0
color: textField.color color: control.color
} }
} }
} }

View file

@ -347,6 +347,14 @@
"radio_text": "text_default", "radio_text": "text_default",
"radio_text_disabled": "text_disabled", "radio_text_disabled": "text_disabled",
"text_field": "background_1",
"text_field_border": [180, 180, 180, 255],
"text_field_border_hovered": "border_main",
"text_field_border_disabled": "border_main",
"text_field_text": "text_default",
"text_field_text_disabled": "text_disabled",
"category_background": "background_2", "category_background": "background_2",