fix(StatusBaseInput): ensure clear button has the correct color

Also only render clear button when input has active focus.

Closes #286
This commit is contained in:
Pascal Precht 2021-07-23 12:02:00 +02:00 committed by Michał Cieślak
parent 3755e1fdd6
commit e966641ed1
2 changed files with 10 additions and 1 deletions

View File

@ -19,6 +19,11 @@ Column {
enabled: false enabled: false
} }
StatusBaseInput {
placeholderText: "Clearable"
clearable: true
}
StatusBaseInput { StatusBaseInput {
multiline: true multiline: true
placeholderText: "Multiline" placeholderText: "Multiline"

View File

@ -147,7 +147,10 @@ Item {
StatusFlatRoundButton { StatusFlatRoundButton {
id: clearButtton id: clearButtton
visible: edit.text.length != 0 && statusBaseInput.clearable && !statusBaseInput.multiline visible: edit.text.length != 0 &&
statusBaseInput.clearable &&
!statusBaseInput.multiline &&
edit.activeFocus
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 11 anchors.rightMargin: 11
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -157,6 +160,7 @@ Item {
icon.name: "clear" icon.name: "clear"
icon.width: 14 icon.width: 14
icon.height: 14 icon.height: 14
icon.color: Theme.palette.baseColor1
onClicked: { onClicked: {
edit.clear() edit.clear()
} }