在QT Demo 之 threading一章中我们使用到了Spinner,但是由于Spinner本身和thread部分关系不大,而是作为一个独立的自定义组件,因此我们在这一章中单独讲解。
Spinner定义在threading/workerscript/Spinner.qml文件中,由一个Text和Rectangle组成:
Rectangle {
width: 64
height: 64
property alias value: list.currentIndex
property alias label: caption.text
Text {...}
Rectangle {...}
}
Text就是Spinner上面的标签,如在threading示例中使用到的两个Spinner,其标签分别是Row和Column:
而Rectangle部分则是下面的具体数据部分,包括了一个ListView和一个子Rectangle: