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 property bool isTextInMinValue:true; property string textInMinValue:"inf"; property int singleStep: 2; signal valueChange(int intiger); function stringToInt(string){ var value=0; var pow10=1; if(isTextInMinValue && textInMinValue==string) value=minValue; else 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)+singleStep); else if (event.key == Qt.Key_Down){ text_input1.text=((stringToInt(text_input1.text)-singleStep)maxValue)?(maxValue):(stringToInt(text_input1.text)+singleStep); 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)-singleStep)maxValue)?(maxValue):(stringToInt(text_input1.text)+singleStep); 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)-singleStep)