Unify text field/area focus line into a component
This commit is contained in:
parent
8b0f408f34
commit
07013d0ed4
22
src/gui/Base/HBottomFocusLine.qml
Normal file
22
src/gui/Base/HBottomFocusLine.qml
Normal file
|
@ -0,0 +1,22 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
|
||||
|
||||
HRectangleBottomBorder {
|
||||
id: line
|
||||
|
||||
|
||||
property bool show: false
|
||||
|
||||
|
||||
transform: Scale {
|
||||
origin.x: line.width / 2
|
||||
origin.y: line.height / 2
|
||||
xScale: line.show ? 1 : 0
|
||||
|
||||
Behavior on xScale { HNumberAnimation {} }
|
||||
}
|
||||
|
||||
Behavior on color { HColorAnimation {} }
|
||||
}
|
|
@ -55,20 +55,10 @@ TextArea {
|
|||
border.width: bordered ? theme.controls.textArea.borderWidth : 0
|
||||
border.color: borderColor
|
||||
|
||||
HRectangleBottomBorder {
|
||||
id: bottomBorder
|
||||
HBottomFocusLine {
|
||||
show: textArea.activeFocus
|
||||
borderHeight: theme.controls.textArea.borderWidth
|
||||
color: error ? errorBorder : focusedBorderColor
|
||||
|
||||
transform: Scale {
|
||||
origin.x: bottomBorder.width / 2
|
||||
origin.y: bottomBorder.height / 2
|
||||
xScale: textArea.activeFocus ? 1 : 0
|
||||
|
||||
Behavior on xScale { HNumberAnimation {} }
|
||||
}
|
||||
|
||||
Behavior on color { HColorAnimation {} }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,20 +30,10 @@ TextField {
|
|||
border.width: bordered ? theme.controls.textField.borderWidth : 0
|
||||
border.color: borderColor
|
||||
|
||||
HRectangleBottomBorder {
|
||||
id: bottomBorder
|
||||
HBottomFocusLine {
|
||||
show: field.activeFocus
|
||||
borderHeight: theme.controls.textField.borderWidth
|
||||
color: error ? errorBorder : focusedBorderColor
|
||||
|
||||
transform: Scale {
|
||||
origin.x: bottomBorder.width / 2
|
||||
origin.y: bottomBorder.height / 2
|
||||
xScale: field.activeFocus ? 1 : 0
|
||||
|
||||
Behavior on xScale { HNumberAnimation {} }
|
||||
}
|
||||
|
||||
Behavior on color { HColorAnimation {} }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user