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

46 lines
1.0 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: []
property var lstName: lst.map(function(item) { return item.replace(/^check_(.*)\.pys$/, "$1"); })
Component.onCompleted:{
var checkfiles = common.getCheckFileName()
checkfiles.unshift("无")
lst = checkfiles
value = lst[0]
}
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: lstName
onActivated: {
value = lst[currentIndex]
}
}
function setValue(_value)
{
value = _value
cb.currentIndex = cb.find(_value.replace(/^check_(.*)\.pys$/, "$1"))
}
}