This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
app/resources/qml/components/InputDelegate.qml

68 lines
1.5 KiB
QML
Raw Normal View History

import QtQuick 2.0
2020-04-02 17:40:22 +02:00
import QtQuick.Controls 2.2
SmoothItemDelegate {
id: control
property string inputText: ""
property string inputHint: ""
signal inputFinished()
property int inputMethodHints: Qt.ImhNone
property int inputTextFieldWidth: control.width * 0.3
onInputTextChanged: {
textField.text = inputText
}
width: parent.width
rightPadding: textField.width + width * 0.02
height: parent.delegateHeight
TextField {
id: textField
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
width: control.inputTextFieldWidth
height: parent.height
focus: true
placeholderText: control.inputHint
font.pixelSize: height * 0.4
inputMethodHints: control.inputMethodHints
palette.text: appTheme.style.textColor
onTextChanged: {
control.inputText = text
control.inputTextChanged()
}
onActiveFocusChanged: {
if(!activeFocus){
control.inputFinished()
}
}
background: Rectangle {
implicitWidth: 200
implicitHeight: 40
color: "transparent"//control.enabled ? "transparent" : "#353637"
border.color: (textField.activeFocus ? "#21be2b" : "#999999")
radius: height * 0.3
}
Behavior on opacity {
NumberAnimation {
duration: 200
}
}
}
}