TG-PlatformPlus/qml/Instruction/common/LineLastCombobox.qml

47 lines
1.1 KiB
QML
Raw Normal View History

2026-03-02 14:29:58 +08:00
import QtQuick
import QtQuick.Controls
BaseCommon
{
id: self
width: parent.width
height: 25
property var lst: [{"value":"0","name":"末尾"},{"value":"-1","name":"第-1"},{"value":"-2","name":"第-2"},{"value":"-3","name":"第-3"},{"value":"-4","name":"第-4"}]
Item
{
id: titleItem
width: 100
height: parent.height
Text{
id: titleText
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
text: title
}
}
ComboBox{
id: cb
anchors.left: titleItem.right
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
model: lst
textRole: "name"
onActivated: {
value = lst[currentIndex].value
}
}
function setValue(_value)
{
for(var i =0;i<cb.model.length;i++)
{
if(cb.model[i].value == _value)
{
cb.currentIndex = i
value = _value
break
}
}
}
}