[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/krita-sketch-rempt] krita/sketch/qml/components: Visualise button enabled-state properly (
From:       Dan Leinir Turthra Jensen <admin () leinir ! dk>
Date:       2012-10-26 13:57:12
Message-ID: 20121026135712.E6756A6078 () git ! kde ! org
[Download RAW message or body]

Git commit d90c111f1b39cc5602e8fdaaf1d336d460a23bb1 by Dan Leinir Turthra Jensen.
Committed on 26/10/2012 at 15:55.
Pushed by leinir into branch 'krita-sketch-rempt'.

Visualise button enabled-state properly (dim when not enabled)

M  +12   -10   krita/sketch/qml/components/Button.qml

http://commits.kde.org/calligra/d90c111f1b39cc5602e8fdaaf1d336d460a23bb1

diff --git a/krita/sketch/qml/components/Button.qml b/krita/sketch/qml/components/Button.qml
index 439b4ec..0c9cc64 100644
--- a/krita/sketch/qml/components/Button.qml
+++ b/krita/sketch/qml/components/Button.qml
@@ -49,7 +49,7 @@ Item {
         id: fill;
         anchors.fill: parent;
         anchors.margins: 0;
-        color: base.highlight && mouse.pressed ? base.highlightColor : "transparent";
+        color: base.highlight && mouse.pressed && base.enabled ? base.highlightColor : "transparent";
         visible: true
 
         Image {
@@ -58,6 +58,7 @@ Item {
             anchors.margins: 8;
             fillMode: Image.PreserveAspectFit;
             smooth: true;
+            opacity: base.enabled ? 1 : 0.7;
 
             sourceSize.width: width > height ? height : width;
             sourceSize.height: width > height ? height : width;
@@ -70,19 +71,20 @@ Item {
             width: parent.width;
             horizontalAlignment: Text.AlignHCenter;
             elide: Text.ElideMiddle;
+            opacity: base.enabled ? 1 : 0.7;
         }
-        Rectangle {
-            id: enabledVisualiser;
-            opacity: enabled ? 0 : 0.7;
-            anchors.fill: parent;
-            color: "black";
-        }
+//         Rectangle {
+//             id: enabledVisualiser;
+//             opacity: base.enabled ? 0 : 0.7;
+//             anchors.fill: parent;
+//             color: "black";
+//         }
     }
 
     SimpleTouchArea {
         anchors.fill: parent;
         onTouched: {
-            if (enabled) {
+            if (base.enabled) {
                 base.clicked();
                 if( base.checkable ) {
                     base.checked = !base.checked;
@@ -94,7 +96,7 @@ Item {
         id: mouse;
         anchors.fill: parent;
         onClicked: {
-            if (enabled) {
+            if (base.enabled) {
                 base.clicked();
                 if( base.checkable ) {
                     base.checked = !base.checked;
@@ -105,7 +107,7 @@ Item {
 
     states: State {
         name: "pressed";
-        when: mouse.pressed || base.checked;
+        when: (mouse.pressed || base.checked) && enabled;
 
 
         PropertyChanges {

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic