QML 下拉列表框的使用
世界上一成不变的东西,只有“任何事物都是在不断变化的”这条真理。
ComboBox {
id:combox
x: structureTab_label2.x+structureTab_label2.width+5
y: structureTab_label2.y
currentIndex: 0
model: ListModel {
id: cbItems
ListElement { text: "当前节点前"; color: "Yellow" }
ListElement { text: "当前节点后"; color: "Green" }
}
width: 160
onCurrentIndexChanged: {
if(currentIndex==0){
console.debug(cbItems.get(currentIndex).text + ", " + cbItems.get(currentIndex).color)
console.debug("0")
}
if(currentIndex==1){
console.debug("1")
}
}
}
It Provides a drop-down list functionality.
Import Statement: import QtQuick.Controls 1.4Since: Qt 5.1
Inherits(继承):FocusScope