nheko/resources/qml/MatrixTextField.qml

73 lines
1.5 KiB
QML
Raw Normal View History

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