diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/DoubleSpinBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/DoubleSpinBox.qml index 9827d7e58a12daf7c147354a56e1099384ded2b6..4d78e86ddda6c5abc79526d482d24b97ca7f1622 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/DoubleSpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/DoubleSpinBox.qml @@ -26,15 +26,15 @@ QWidget { //This is a special DoubleSpinBox that does color coding for states function evaluate() { if (baseStateFlag) { if (backendValue != null && backendValue.isInModel) - DoubleSpinBox.setStyleSheet("color: white;"); + DoubleSpinBox.setStyleSheet("color: white;"); else - DoubleSpinBox.setStyleSheet("color: gray;"); - } else { - if (backendValue != null && backendValue.isInSubState) + DoubleSpinBox.setStyleSheet("color: gray;"); + } else { + if (backendValue != null && backendValue.isInSubState) DoubleSpinBox.setStyleSheet("color: #7799FF;"); - else + else DoubleSpinBox.setStyleSheet("color: gray;"); - } + } } } @@ -50,19 +50,26 @@ QWidget { //This is a special DoubleSpinBox that does color coding for states decimals: 2; keyboardTracking: false; enabled: (backendValue == null || backendValue.complexNode == null) ? false : !backendValue.isBound && !backendValue.complexNode.exists - value: DoubleSpinBox.backendValue == null ? .0 : DoubleSpinBox.backendValue.value; - onValueChanged: { - if (DoubleSpinBox.backendValue != null) + property bool readingFromBackend: false; + property real valueFromBackend: DoubleSpinBox.backendValue == null ? .0 : DoubleSpinBox.backendValue.value; + onValueFromBackendChanged: { + readingFromBackend = true; + value = valueFromBackend + readingFromBackend = false; + } + + onValueChanged: { + if (DoubleSpinBox.backendValue != null && readingFromBackend == false) DoubleSpinBox.backendValue.value = value; - } - onFocusChanged: { - //extendedSwitches.active = focus; - //extendedSwitches.backendValue = backendValue; - } - - onMouseOverChanged: { - //extendedButton.active = mouseOver; - } + } + onFocusChanged: { + //extendedSwitches.active = focus; + //extendedSwitches.backendValue = backendValue; + } + + onMouseOverChanged: { + //extendedButton.active = mouseOver; + } } } @@ -80,10 +87,10 @@ QWidget { //This is a special DoubleSpinBox that does color coding for states opacity: Behavior { NumberAnimation { - easing: "easeInSine" - duration: 200 - } + easing: "easeInSine" + duration: 200 } + } onPressed: { @@ -103,7 +110,7 @@ QWidget { //This is a special DoubleSpinBox that does color coding for states } } } - } + } onMouseOverChanged: { if (mouseOver) { diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml index 5ecefa96a2dd7842f4b49eebe5b2337622d4e91c..5965a373c8094751f93cf3956b44f0adb9e2fbde 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml @@ -28,10 +28,10 @@ QWidget { //This is a special SpinBox that does color coding for states else SpinBox.setStyleSheet("color: gray;"); } else { - if (backendValue != null && backendValue.isInSubState) - SpinBox.setStyleSheet("color: #7799FF;"); - else - SpinBox.setStyleSheet("color: gray;"); + if (backendValue != null && backendValue.isInSubState) + SpinBox.setStyleSheet("color: #7799FF;"); + else + SpinBox.setStyleSheet("color: gray;"); } } } @@ -49,9 +49,17 @@ QWidget { //This is a special SpinBox that does color coding for states keyboardTracking: false; id: box; enabled: backendValue === undefined || backendValue.isBound === undefined || backendValue.isBound === null ? false : !backendValue.isBound - value: backendValue == undefined || backendValue.value == undefined || backendValue.value === null ? 0 : backendValue.value; + property bool readingFromBackend: false; + property int valueFromBackend: SpinBox.backendValue == null ? .0 : SpinBox.backendValue.value; + + onValueFromBackendChanged: { + readingFromBackend = true; + value = valueFromBackend + readingFromBackend = false; + } + onValueChanged: { - if (backendValue != undefined && backendValue != null) + if (SpinBox.backendValue != null && readingFromBackend == false) backendValue.value = value; } onFocusChanged: { @@ -61,7 +69,7 @@ QWidget { //This is a special SpinBox that does color coding for states } } - QToolButton { + QToolButton { visible: false; width: 10; height: 10;