matrixion/resources/qml/MatrixTextField.qml

73 lines
1.5 KiB
QML
Raw 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-05-13 11:57:04 +03:00
import im.nheko 1.0
2021-02-23 19:06:21 +03:00
TextField {
2021-02-23 19:06:21 +03:00
id: input
2021-07-17 23:17:05 +03:00
property alias backgroundColor: backgroundRect.color
2021-05-13 09:23:56 +03:00
palette: Nheko.colors
2021-05-22 16:19:44 +03:00
color: Nheko.colors.text
2021-02-23 19:06:21 +03:00
Rectangle {
id: blueBar
anchors.top: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
2021-05-13 09:23:56 +03:00
color: Nheko.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
2021-05-13 09:23:56 +03:00
color: Nheko.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 {
2021-07-17 23:17:05 +03:00
id: backgroundRect
2021-05-13 09:23:56 +03:00
color: Nheko.colors.base
}
}