6 border.color: "#000666";
7 property int maxValue:500;
8 property int minValue:0;
9 property alias value:text_input1.text
10 property bool isTextInMinValue:true;
11 property string textInMinValue:"inf";
12 property int singleStep: 2;
14 signal valueChange(int intiger);
16 function stringToInt(string){
19 if(isTextInMinValue && textInMinValue==string)
22 for (var i=string.length-1;i>=0;i--){
23 value+=(string.charCodeAt(i)-48)*pow10;
34 text_input1.focus=true;
40 width: rectangle1.width-15
41 height: rectangle1.height*0.6;
43 anchors.centerIn: parent
44 validator: IntValidator{bottom: minValue; top: maxValue;}
45 transformOrigin: Item.Left
47 font.pixelSize: rectangle1.height * .5;
48 onCursorPositionChanged: moveCursorSelection(cursorPosition);
50 if(isTextInMinValue && text_input1.text!="" && stringToInt(text_input1.text)==minValue)
51 text_input1.text=textInMinValue;
53 rectangle1.valueChange(stringToInt(text_input1.text));
57 text=stringToInt(text);
60 if (event.key == Qt.Key_Up)
61 text_input1.text=((stringToInt(text_input1.text)+singleStep)>maxValue)?(maxValue):(stringToInt(text_input1.text)+singleStep);
62 else if (event.key == Qt.Key_Down){
63 text_input1.text=((stringToInt(text_input1.text)-singleStep)<minValue)?(minValue):(stringToInt(text_input1.text)-singleStep);
64 if(isTextInMinValue && stringToInt(text_input1.text)==minValue)
65 text_input1.text=textInMinValue
76 if(mouseAreaUp.pressedButtons==Qt.LeftButton)
77 text_input1.text=((stringToInt(text_input1.text)+singleStep)>maxValue)?(maxValue):(stringToInt(text_input1.text)+singleStep);
89 if(mouseAreaDown.pressedButtons==Qt.LeftButton){
90 text_input1.text=((stringToInt(text_input1.text)-singleStep)<minValue)?(minValue):(stringToInt(text_input1.text)-singleStep);
91 if(isTextInMinValue && stringToInt(text_input1.text)==minValue)
92 text_input1.text=textInMinValue
102 height: parent.height;
103 anchors.centerIn: parent;
104 radius: parent.radius
114 anchors.right: parent.right
115 anchors.top: parent.top
116 anchors.rightMargin: 2
118 source: "qrc:/button/up_enable.png";
126 anchors.right: parent.right
127 anchors.bottom: parent.bottom
128 anchors.rightMargin: 2
129 anchors.bottomMargin: 2
130 source: "qrc:/button/down_enable.png";
137 height: rectangle1.height/2;
138 anchors.right: parent.right
139 anchors.top: parent.top
140 onClicked: text_input1.text=((stringToInt(text_input1.text)+singleStep)>maxValue)?(maxValue):(stringToInt(text_input1.text)+singleStep);
143 timerUp.running=true;
151 height: rectangle1.height/2;
152 anchors.right: parent.right
153 anchors.bottom: parent.bottom
155 text_input1.text=((stringToInt(text_input1.text)-singleStep)<minValue)?(minValue):(stringToInt(text_input1.text)-singleStep);
156 if(isTextInMinValue && stringToInt(text_input1.text)==minValue)
157 text_input1.text=textInMinValue
161 timerDown.running=true;
166 name: "focusState"; when: text_input1.focus && rectangle1.enabled;
167 PropertyChanges { target: rectangle1; border.width: 2 }