有人知道如何创建链接到文本(数字)的按钮吗?
只要按下按钮就会超过它的价值?
我试过这个:
Button { width:100 height:100 text: “up” onPressed: { ++myText.text; } } Text { id:myText text:1 }
但这只会增加一次值。
发布于 2011-06-20 21:43:41
你需要一个计时器来做这项工作。
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
}
}https://stackoverflow.com/questions/6411761
复制相似问题