id: rectangle1
radius: 10
border.color: "#000666";
-// property int maxValue:500;
-// property int minValue:0;
property alias value:text1.text
+ property alias index: list1.currentIndex
+ property alias model: list1.model
property bool expanded: false
+ property bool disabled: false
+ property int expandedHeight
+ property int basicHeight
+ property string startValue
+ height: basicHeight
function show(Boolean){
- //mozna jeszcze to w tle ukrywać
expanded = Boolean
}
- signal valueSelected(string selected); //?
-
-// 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(value<minValue)
-// return minValue;
-// return value;
-// }
+ function setStartValue(val, idx){
+ startValue = val
+ list1.currentIndex = idx
+ }
+
+ signal valueSelected(string selected);
Text {
id: text1
- x: 1
width: rectangle1.width-15
height: rectangle1.height*0.6;
text: list1.selected
anchors.centerIn: parent
font.pixelSize: rectangle1.height * .5;
- onTextChanged: {} //stub, tu reakcja na zmianę wyboru z listy
+ onTextChanged: { rectangle1.valueSelected(text) }
}
-// TextInput {
-// id: text_input1
-// x: 1
-// width: rectangle1.width-15
-// height: rectangle1.height*0.6;
-// text: "123"
-// anchors.centerIn: parent
-// validator: IntValidator{bottom: minValue; top: maxValue;}
-// transformOrigin: Item.Left
-// selectByMouse: true;
-// font.pixelSize: rectangle1.height * .5;
-// onCursorPositionChanged: moveCursorSelection(cursorPosition);
-// onTextChanged: rectangle1.valueChange(stringToInt(text_input1.text));
-// onFocusChanged: {
-// if(focus==false)
-// text=stringToInt(text);
-// }
-// }
-
Rectangle {
id: shadeDisable
width: parent.width;
anchors.centerIn: parent;
radius: parent.radius
color: "grey";
- opacity: 0
- }
-
- Image {
- id: imageUp
- z:4;
- width: 11;
- height: 6;
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.rightMargin: 2
- anchors.topMargin: 2
- source: "qrc:/button/up_enable.png";
+ opacity: 0.5
}
Image {
id: imageDown
z:4;
width: 11;
- height: 6;
+ height: 0.5 * rectangle1.height;
+ anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: parent.bottom
- anchors.rightMargin: 2
- anchors.bottomMargin: 2
+ anchors.topMargin: 4
+ anchors.rightMargin: 6
+ anchors.bottomMargin: 4
source: "qrc:/button/down_enable.png";
}
width: parent.width
visible: false
z: 0
- property string selected: startValue//inicjowane z cpp
+ property string selected: rectangle1.startValue
function selectedValue(nr, value) {
currentIndex = nr
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
highlightResizeSpeed: 1000
- model: comboBoxModel
delegate: Component{
id: list1Delegate
states: [
State {
name: "basic";
- when: rectangle1.expanded = false
+ when: (rectangle1.expanded == false && rectangle1.disabled == false)
PropertyChanges { target: list1; z: 0; visible: false }
- PropertyChanges {target: listMouseArea; z: 1 }
+ PropertyChanges { target: text1; z: 0; visible: true }
+ PropertyChanges { target: rectangle1; border.width: 1}
+ PropertyChanges { target: rectangle1; height: rectangle1.basicHeight}
+ PropertyChanges { target: imageDown; visible: true}
+ PropertyChanges { target: shadeDisable; visible: false; z:-1}
},
State {
name: "expanded"
- when: rectangle1.expanded = true
+ when: (rectangle1.expanded == true && rectangle1.disabled == false)
PropertyChanges { target: list1; z: 10; visible: true }
- PropertyChanges {target: listMouseArea; z: 11 }
+ PropertyChanges { target: text1; z: 10; visible: false }
+ PropertyChanges { target: rectangle1; border.width: 0}
+ PropertyChanges { target: rectangle1; height: rectangle1.expandedHeight}
+ PropertyChanges { target: imageDown; visible: false}
+ PropertyChanges { target: shadeDisable; visible: false; z: -1}
+ },
+ State {
+ name: "disabled";
+ when: rectangle1.disabled == true
+ PropertyChanges { target: list1; z: 0; visible: false }
+ PropertyChanges { target: text1; z: 0; visible: true }
+ PropertyChanges { target: rectangle1; border.width: 1}
+ PropertyChanges { target: rectangle1; expanded: false}
+ PropertyChanges { target: rectangle1; height: rectangle1.basicHeight}
+ PropertyChanges { target: imageDown; visible: true}
+ PropertyChanges { target: shadeDisable; visible: true; z:10}
}
]