Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
只要按下按钮,有谁知道如何创建一个链接到文本(数字)并高于其值的按钮?
我试过这个:
Button { width:100 height:100 text: “up” onPressed: { ++myText.text; } } Text { id:myText text:1 }
但这只会增加一次价值。
你需要一个计时器来完成这项工作。
Item { Button { id:button1 width:100 height:100 text: “up” onPressed: { ++myText.text; } } Text { id:myText text:1 } Timer { interval: 500; running: button1.pressed ; repeat: true onTriggered: ++myText.text } }