import Qt 4.7 Rectangle { id: rectangle1 radius: 10 border.color: "#000666"; property int maxValue:500; property int minValue:0; property alias value:text_input1.text signal valueChange(int intiger); function stringToInt(string){ var value=0; var pow10=1; for (var i=string.length-1;i>=0;i--){ value+=(string.charCodeAt(i)-48)*pow10; pow10= pow10*10; } if(value>maxValue) return maxValue; if(valuemaxValue)?(maxValue):(stringToInt(text_input1.text)+1); else running=false; } } Timer { id:timerDown; interval: 100; running: false; repeat: true onTriggered:{ if(mouseAreaDown.pressedButtons==Qt.LeftButton) text_input1.text=((stringToInt(text_input1.text)-1)maxValue)?(maxValue):(stringToInt(text_input1.text)+1); onPressAndHold:{ timerUp.restart; timerUp.running=true; } } MouseArea { id: mouseAreaDown z:5 width: 13; height: rectangle1.height/2; anchors.right: parent.right anchors.bottom: parent.bottom onClicked: text_input1.text=((stringToInt(text_input1.text)-1)