diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml
index a632863ad7b05c8307311f239ce4e623f9006e2e..b28221d33b0406b7eb589473c9e58768f600b6ad 100644
--- a/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml
+++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml
@@ -25,6 +25,9 @@ QWidget { //This is a special spinBox that does color coding for states
 
     Script {
         function evaluate() {
+		    print("evaluate")
+			print(baseStateFlag)
+			print(backendValue.isInModel)
             if (baseStateFlag) {
                 if (backendValue != null && backendValue.isInModel)
                     box.setStyleSheet("color: white;");
@@ -38,6 +41,18 @@ QWidget { //This is a special spinBox that does color coding for states
             }
         }
     }
+	
+	property bool isInModel: (backendValue === undefined || backendValue === null) ? false: backendValue.isInModel;
+
+    onIsInModelChanged: {
+        evaluate();
+    }
+
+    property bool isInSubState: (backendValue === undefined || backendValue === null) ? false: backendValue.isInSubState;
+
+    onIsInSubStateChanged: {
+        evaluate();
+    }
 
     layout: HorizontalLayout {
         
@@ -48,12 +63,13 @@ QWidget { //This is a special spinBox that does color coding for states
             id: box;
             enabled: backendValue === undefined || backendValue.isBound === undefined || backendValue.isBound === null ? false : !backendValue.isBound
             property bool readingFromBackend: false;
-            property int valueFromBackend: (spinBox.backendValue === undefined || spinBox.backendValue == null)
+            property int valueFromBackend: (spinBox.backendValue === undefined || spinBox.backendValue == null  || spinBox.backendValue.value === undefined)
             ? .0 : spinBox.backendValue.value;
 
             onValueFromBackendChanged: {
                 readingFromBackend = true;
-                value = valueFromBackend
+				if (!(valueFromBackend  === undefined))
+                    value = valueFromBackend;
                 readingFromBackend = false;
                 evaluate();
             }
@@ -69,6 +85,10 @@ QWidget { //This is a special spinBox that does color coding for states
 				else
 				    spinBox.backendValue.unlock();
 			}
+			
+			onEditingFinished: {
+				focus = false;
+			}
         }
     }