Fix button graphics when button was pressed or disabled. Add disabled state to button...
[mdictionary] / src / mdictionary / qml / Button.qml
index a21cf2f..224a548 100644 (file)
@@ -27,15 +27,15 @@ BorderImage {
         style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true
     }
 
-    Rectangle {
-        id: shade
-        anchors.centerIn: parent;
-        radius: parent.height*.4;
-        color: "black";
-        opacity: 0
-        width:  parent.width;
-        height: parent.height;
-    }
+//    Rectangle {
+//        id: shade
+//        anchors.centerIn: parent;
+//        radius: parent.height*.4;
+//        color: "black";
+//        opacity: 0
+//        width:  parent.width;
+//        height: parent.height;
+//    }
 
     Image {
         id: image1
@@ -68,11 +68,20 @@ BorderImage {
 
     states: [
         State {
-            name: "pressed"; when: mouseArea.pressed == true
-            PropertyChanges { target: shade; opacity: 0.4 }
-            PropertyChanges { target: image1; opacity: 0.5 }
-            PropertyChanges { target: image3; opacity: 0.5 }
-            PropertyChanges { target: image2; opacity: 0.5 }
+            name: "pressed";
+            when: (mouseArea.pressed == true && button.enabled == true);
+
+            PropertyChanges { target: image1; source: "qrc:/button/buttonLeftPushed.png" }
+            PropertyChanges { target: image3; source: "qrc:/button/buttonCenterPushed.png" }
+            PropertyChanges { target: image2; source: "qrc:/button/buttonRightPushed.png" }
+        },
+        State {
+            name: "disabled";
+            when: (button.enabled == false);
+
+            PropertyChanges { target: image1; source: "qrc:/button/buttonLeftDisabled.png" }
+            PropertyChanges { target: image3; source: "qrc:/button/buttonCenterDisabled.png" }
+            PropertyChanges { target: image2; source: "qrc:/button/buttonRightDisabled.png" }
         }
     ]