Commit 4f2a420d authored by Christiaan Janssen's avatar Christiaan Janssen
Browse files

QmlDesigner.PropertyEditor: Color controls now use color scheme when modified

parent 61acda31
......@@ -5,9 +5,7 @@ QExtGroupBox {
id: colorGroupBox
property var finished;
property var backendColor
property var oldMaximumHeight;
property var startupCollapse: selectionChanged;
......@@ -30,6 +28,63 @@ QExtGroupBox {
}
}
property var baseStateFlag: isBaseState
onBaseStateFlagChanged: {
evaluate();
}
onBackendColorChanged: {
evaluate();
}
property var isEnabled: colorGroupBox.enabled
onIsEnabledChanged: {
evaluate();
}
property bool isInModel: (backendColor === undefined || backendColor === null) ? false: backendColor.isInModel;
onIsInModelChanged: {
evaluate();
}
property bool isInSubState: (backendColor === undefined || backendColor === null) ? false: backendColor.isInSubState;
onIsInSubStateChanged: {
evaluate();
}
Script {
function evaluate() {
if (!enabled) {
valueSpinBox.setStyleSheet("color: "+scheme.disabledColor);
hueSpinBox.setStyleSheet("color: "+scheme.disabledColor);
saturationSpinBox.setStyleSheet("color: "+scheme.disabledColor);
} else {
if (baseStateFlag) {
if (backendColor != null && backendColor.isInModel) {
valueSpinBox.setStyleSheet("color: "+scheme.changedBaseColor);
hueSpinBox.setStyleSheet("color: "+scheme.changedBaseColor);
saturationSpinBox.setStyleSheet("color: "+scheme.changedBaseColor);
} else {
valueSpinBox.setStyleSheet("color: "+scheme.defaultColor);
hueSpinBox.setStyleSheet("color: "+scheme.defaultColor);
saturationSpinBox.setStyleSheet("color: "+scheme.defaultColor);
}
} else {
if (backendColor != null && backendColor.isInSubState) {
valueSpinBox.setStyleSheet("color: "+scheme.changedStateColor);
hueSpinBox.setStyleSheet("color: "+scheme.changedStateColor);
saturationSpinBox.setStyleSheet("color: "+scheme.changedStateColor);
} else {
valueSpinBox.setStyleSheet("color: "+scheme.defaultColor);
hueSpinBox.setStyleSheet("color: "+scheme.defaultColor);
saturationSpinBox.setStyleSheet("color: "+scheme.defaultColor);
}
}
}
}
}
ColorScheme { id:scheme; }
>>>>>>> QmlDesigner.PropertyEditor: Color controls now use color scheme when modified:share/qtcreator/qmldesigner/propertyeditor/Qt/ColorGroupBox.qml
QWidget {
id: colorButtonWidget
height: 32
......@@ -83,8 +138,9 @@ QExtGroupBox {
ColorBox {
id: colorControl;
property var backendColor: colorGroupBox.backendColor.value;
color: colorGroupBox.backendColor.value;
onColorChanged: {
onColorChanged: if (colorGroupBox.backendColor.value != color) {
colorGroupBox.backendColor.value = color;
}
}
......@@ -92,7 +148,7 @@ QExtGroupBox {
HueControl {
id: hueControl;
hue: colorControl.hue;
onHueChanged: colorControl.hue=hue;
onHueChanged: if (colorControl.hue != hue) colorControl.hue=hue;
}
QWidget {
......@@ -110,10 +166,11 @@ QExtGroupBox {
}
QSpinBox {
maximum: 255
id: hueSpinBox
maximum: 359
value: colorControl.hue;
onValueChanged: if (colorControl.hue != value)
colorControl.hue=value;
colorControl.hue=value;
}
}
......@@ -126,6 +183,7 @@ QExtGroupBox {
fixedWidth: 15
}
QSpinBox {
id: saturationSpinBox
maximum: 255
value: colorControl.saturation;
onValueChanged: if (colorControl.saturation !=value)
......@@ -141,6 +199,7 @@ QExtGroupBox {
fixedWidth: 15
}
QSpinBox {
id: valueSpinBox
maximum: 255
value: colorControl.value;
onValueChanged: if (Math.floor(colorControl.value)!=value)
......
......@@ -15,7 +15,7 @@ QWidget {
evaluate();
}
property var isEnabled: comboBox.enabled
property var isEnabled: lineEdit.enabled
onIsEnabledChanged: {
evaluate();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment