47 lines
1.1 KiB
QML
47 lines
1.1 KiB
QML
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
|
|
}
|
|
}
|
|
}
|
|
} |