draft of spinbox
[mdictionary] / src / mdictionary / qml / IconButton.qml
index 948d1b0..dc749a4 100644 (file)
@@ -4,22 +4,16 @@ Rectangle {
     id: rectangle
 
     property alias pathToIcon: image.source;
+    property int iconWidth:rectangle.width;
+    property int iconHeight:rectangle.height;
 
     signal clicked;
-
-    Image {
-        id: image
-        z:1;
-        anchors.centerIn: parent
-        width: rectangle.width;
-        height: rectangle.height;
-    }
-
+    radius: 50
 
     MouseArea {
         id: mouseArea
         anchors.centerIn: parent;
-        width: rectangle.width + (70*parent.height)/107;
+        width: rectangle.width
         height: rectangle.height;
         onClicked: {
             rectangle.clicked();
@@ -27,62 +21,60 @@ Rectangle {
     }
 
     Image {
+        id: image
+        z:4;
+        anchors.centerIn: parent
+        width: iconWidth;
+        height: iconHeight;
+    }
+
+    Image {
         id: image1
-        width: (35*parent.height)/107
+        z: 1
+        smooth: true
+        width: (35*parent.height)/107 +1
         height: parent.height
         anchors.left: parent.left
-        anchors.leftMargin: - (35*parent.height)/107
         source: "qrc:/button/buttonLeft.png"
     }
 
     Image {
         id: image3
-        width: parent.width
+        z: 1
+        smooth: true
+        width: parent.width - (70*parent.height)/107 +1
         height: parent.height
         anchors.horizontalCenter: parent.horizontalCenter
         source: "qrc:/button/buttonCenter.png"
+
     }
 
 
     Image {
         id: image2
-        width: (35*parent.height)/107
+        z: 1
+        smooth: true
+        width: (35*parent.height)/107 +1
         height: parent.height
         anchors.right: parent.right
-        anchors.rightMargin:  - (35*parent.height)/107
         source: "qrc:/button/buttonR.png"
     }
 
-    Rectangle {
-        id: shade
-        anchors.centerIn: parent;
-        color: "black";
-        radius: 20;
-        opacity: 1;
-        width:  rectangle.width+(70*parent.height)/107;
-        height: rectangle.height;
-    }
 
     states: [
         State {
-            name: "enable";
-            when: (mouseArea.pressed == false && rectangle.enabled == true);
-            PropertyChanges { target: shade;
-                              opacity: 0; }
-        },
-        State {
             name: "disable";
             when: (rectangle.enabled == false);
-            PropertyChanges { target: shade;
-                              color: "black";
-                              opacity: .5; }
+            PropertyChanges { target: image1; source: "qrc:/button/buttonLeftDisabled.png" }
+            PropertyChanges { target: image3; source: "qrc:/button/buttonCenterDisabled.png" }
+            PropertyChanges { target: image2; source: "qrc:/button/buttonRightDisabled.png" }
         },
         State {
             name: "clicked";
             when: (mouseArea.pressed == true && rectangle.enabled == true);
-            PropertyChanges { target: shade;
-                              color: "#fffead"
-                              opacity: 0.5; }
+            PropertyChanges { target: image1; source: "qrc:/button/buttonLeftPushed.png" }
+            PropertyChanges { target: image3; source: "qrc:/button/buttonCenterPushed.png" }
+            PropertyChanges { target: image2; source: "qrc:/button/buttonRightPushed.png" }
         }
     ]
 }