matrixion/resources/qml/MatrixTextField.qml

67 lines
1.4 KiB
QML
Raw Permalink Normal View History

2021-03-14 04:45:20 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
2021-03-26 03:20:13 +03:00
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
2021-02-23 19:06:21 +03:00
TextField {
2021-02-23 19:06:21 +03:00
id: input
palette: colors
2021-02-23 19:06:21 +03:00
Rectangle {
id: blueBar
anchors.top: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
color: colors.highlight
2021-02-23 19:06:21 +03:00
height: 1
width: parent.width
2021-02-23 19:06:21 +03:00
Rectangle {
id: blackBar
anchors.verticalCenter: blueBar.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
height: parent.height + 1
2021-02-23 19:06:21 +03:00
width: 0
color: colors.text
2021-02-23 19:06:21 +03:00
states: State {
name: "focused"
when: input.activeFocus == true
2021-02-23 19:06:21 +03:00
PropertyChanges {
target: blackBar
width: blueBar.width
}
2021-02-23 19:06:21 +03:00
}
2021-02-23 19:06:21 +03:00
transitions: Transition {
from: ""
to: "focused"
reversible: true
NumberAnimation {
2021-02-23 19:06:21 +03:00
target: blackBar
properties: "width"
duration: 500
easing.type: Easing.InOutQuad
alwaysRunToEnd: true
2021-02-23 19:06:21 +03:00
}
2021-02-23 19:06:21 +03:00
}
2021-02-23 19:06:21 +03:00
}
2021-02-23 19:06:21 +03:00
}
background: Rectangle {
color: colors.base
}
}