67 lines
1.5 KiB
QML
67 lines
1.5 KiB
QML
import QtQuick 2.0
|
|
import QtQuick.Controls 2.3
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
}
|