ボタンを押している間、Text(数値)
以上の値にリンクされたボタンを作成する方法を知っている人はいますか?qml MouseArea for button
私はこの試み:
Button { width:100 height:100 text: “up” onPressed: { ++myText.text; } } Text { id:myText text:1 }
が、これは一度だけ値を増加させます。
ボタンを押している間、Text(数値)
以上の値にリンクされたボタンを作成する方法を知っている人はいますか?qml MouseArea for button
私はこの試み:
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
}
}
tnx:)................. – dan
['Timer.triggeredOnStart'](http://doc.qt。 nokia.com/4.7-snapshot/qml-timer.html#triggeredOnStart-prop)をtrueに設定すると、onPressedハンドラのインクリメントを複製する必要はありません。 :) –
あなたの質問は明確ではありません。ボタンを押している間、ボタンテキストが増分し続けるようにしますか? – Abhijith
はい...正確に.. – dan