47 lines
1019 B
QML
47 lines
1019 B
QML
|
|
// KeyValueRow.qml
|
||
|
|
|
||
|
|
import QtQuick
|
||
|
|
import QtQuick.Controls
|
||
|
|
import QtQuick.Layouts
|
||
|
|
Item {
|
||
|
|
id: kvr
|
||
|
|
width: parent ? parent.width : 0
|
||
|
|
height: 30
|
||
|
|
property string keyText: key
|
||
|
|
property string valueText: value
|
||
|
|
signal valueChanged()
|
||
|
|
|
||
|
|
Row{
|
||
|
|
anchors.verticalCenter: parent.verticalCenter
|
||
|
|
spacing: 5
|
||
|
|
TextField {
|
||
|
|
width: kvr.width/2.5
|
||
|
|
placeholderText: "Key"
|
||
|
|
text: keyText
|
||
|
|
onTextChanged:
|
||
|
|
{
|
||
|
|
key = text
|
||
|
|
valueChanged()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
TextField {
|
||
|
|
width: kvr.width/2.5
|
||
|
|
placeholderText: "Value"
|
||
|
|
text: valueText
|
||
|
|
onTextChanged:
|
||
|
|
{
|
||
|
|
value = text
|
||
|
|
valueChanged()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
Button {
|
||
|
|
width: kvr.width/8.5
|
||
|
|
text: "删除"
|
||
|
|
onClicked: {
|
||
|
|
keyValues.remove(index)
|
||
|
|
valueChanged()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|