Commit af90e21a authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.propertyEditor: remove checks for undefined

parent 5e10e693
......@@ -19,13 +19,13 @@ QWidget { //This is a special checkBox that does color coding for states
evaluate();
}
property bool isInModel: (backendValue === undefined || backendValue === null) ? false: backendValue.isInModel;
property bool isInModel: backendValue.isInModel;
onIsInModelChanged: {
evaluate();
}
property bool isInSubState: (backendValue === undefined || backendValue === null) ? false: backendValue.isInSubState;
property bool isInSubState: backendValue.isInSubState;
onIsInSubStateChanged: {
evaluate();
......@@ -37,12 +37,12 @@ QWidget { //This is a special checkBox that does color coding for states
localLabel.setStyleSheet("color: "+scheme.disabledColor);
} else {
if (baseStateFlag) {
if (backendValue != null && backendValue.isInModel)
if (backendValue.isInModel)
localLabel.setStyleSheet("color: "+scheme.changedBaseColor);
else
localLabel.setStyleSheet("color: "+scheme.boldTextColor);
} else {
if (backendValue != null && backendValue.isInSubState)
if (backendValue.isInSubState)
localLabel.setStyleSheet("color: "+scheme.changedStateColor);
else
localLabel.setStyleSheet("color: "+scheme.boldTextColor);
......@@ -60,7 +60,7 @@ QWidget { //This is a special checkBox that does color coding for states
QCheckBox {
id: localCheckBox
checkable: true;
checked: (backendValue === undefined || backendValue === null) ? false : backendValue.value;
checked: backendValue.value;
onToggled: {
backendValue.value = checked;
}
......
......@@ -6,9 +6,10 @@ QExtGroupBox {
property var finished;
property var backendColor
property var color: backendColor === undefined ? "#000000" : backendColor.value
property var oldMaximumHeight;
property var startupCollapse: selectionChanged;
property var startupCollapse: selectionChanged === undefined ? false : selectionChanged;
property var firstTime: true;
property var caption: ""
smooth: false
......@@ -42,24 +43,26 @@ QExtGroupBox {
onIsEnabledChanged: {
evaluate();
}
property bool isInModel: (backendColor === undefined || backendColor === null) ? false: backendColor.isInModel;
property bool isInModel: backendColor.isInModel;
onIsInModelChanged: {
evaluate();
}
property bool isInSubState: (backendColor === undefined || backendColor === null) ? false: backendColor.isInSubState;
property bool isInSubState: backendColor.isInSubState;
onIsInSubStateChanged: {
evaluate();
}
Script {
function evaluate() {
if (backendColor === undefined)
return;
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) {
if (backendColor.isInModel) {
valueSpinBox.setStyleSheet("color: "+scheme.changedBaseColor);
hueSpinBox.setStyleSheet("color: "+scheme.changedBaseColor);
saturationSpinBox.setStyleSheet("color: "+scheme.changedBaseColor);
......@@ -69,7 +72,7 @@ QExtGroupBox {
saturationSpinBox.setStyleSheet("color: "+scheme.defaultColor);
}
} else {
if (backendColor != null && backendColor.isInSubState) {
if (backendColor.isInSubState) {
valueSpinBox.setStyleSheet("color: "+scheme.changedStateColor);
hueSpinBox.setStyleSheet("color: "+scheme.changedStateColor);
saturationSpinBox.setStyleSheet("color: "+scheme.changedStateColor);
......@@ -104,7 +107,7 @@ QExtGroupBox {
ColorButton {
id: colorButton
color: colorGroupBox.backendColor.value;
color: colorGroupBox.color;
checkable: true;
checked: false;
minimumHeight: 18;
......@@ -140,9 +143,9 @@ QExtGroupBox {
ColorBox {
id: colorControl;
property var backendColor: colorGroupBox.backendColor.value;
color: colorGroupBox.backendColor.value;
onColorChanged: if (colorGroupBox.backendColor.value != color) {
property var backendColor: colorGroupBox.color;
color: colorGroupBox.color;
onColorChanged: if (colorGroupBox.color != color) {
colorGroupBox.backendColor.value = color;
}
}
......
......@@ -24,16 +24,18 @@ QWidget {
Script {
function evaluate() {
if (backendValue === undefined)
return;
if (!enabled) {
box.setStyleSheet("color: "+scheme.disabledColor);
} else {
if (baseStateFlag) {
if (backendValue != null && backendValue.isInModel)
if (backendValue.isInModel)
box.setStyleSheet("QComboBox,QComboBox:on{color: "+scheme.changedBaseColor+"}QComboBox:off{color:"+scheme.optionsColor+"}");
else
box.setStyleSheet("QComboBox,QComboBox:on{color: "+scheme.defaultColor+"}QComboBox:off{color:"+scheme.optionsColor+"}");
} else {
if (backendValue != null && backendValue.isInSubState)
if (backendValue.isInSubState)
box.setStyleSheet("QComboBox,QComboBox:on{color: "+scheme.changedStateColor+"}QComboBox:off{color:"+scheme.optionsColor+"}");
else
box.setStyleSheet("QComboBox,QComboBox:on{color: "+scheme.defaultColor+"}QComboBox:off{color:"+scheme.optionsColor+"}");
......@@ -51,8 +53,7 @@ QWidget {
property var backendValue: comboBox.backendValue
onCurrentTextChanged: { backendValue.value = currentText; evaluate(); }
ExtendedFunctionButton {
backendValue: (comboBox.backendValue === undefined || comboBox.backendValue === null)
? null : comboBox.backendValue;
backendValue: comboBox.backendValue;
y: 3
x: 3
}
......
......@@ -31,16 +31,18 @@ QWidget { //This is a special doubleSpinBox that does color coding for states
Script {
function evaluate() {
if (backendValue === undefined)
return;
if (!enabled) {
box.setStyleSheet("color: "+scheme.disabledColor);
} else {
if (baseStateFlag) {
if (backendValue != null && backendValue.isInModel)
if (backendValue.isInModel)
box.setStyleSheet("color: "+scheme.changedBaseColor);
else
box.setStyleSheet("color: "+scheme.defaultColor);
} else {
if (backendValue != null && backendValue.isInSubState)
if (backendValue.isInSubState)
box.setStyleSheet("color: "+scheme.changedStateColor);
else
box.setStyleSheet("color: "+scheme.defaultColor);
......@@ -51,13 +53,13 @@ QWidget { //This is a special doubleSpinBox that does color coding for states
ColorScheme { id:scheme; }
property bool isInModel: (backendValue === undefined || backendValue === null) ? false: backendValue.isInModel;
property bool isInModel: backendValue.isInModel;
onIsInModelChanged: {
evaluate();
}
property bool isInSubState: (backendValue === undefined || backendValue === null) ? false: backendValue.isInSubState;
property bool isInSubState: backendValue.isInSubState;
onIsInSubStateChanged: {
evaluate();
......@@ -78,14 +80,10 @@ QWidget { //This is a special doubleSpinBox that does color coding for states
id: box;
decimals: 1;
keyboardTracking: false;
enabled: (doubleSpinBox.backendValue === undefined ||
doubleSpinBox.backendValue === null)
? true : !backendValue.isBound && doubleSpinBox.enabled;
enabled: !backendValue.isBound && doubleSpinBox.enabled;
property bool readingFromBackend: false;
property real valueFromBackend: (doubleSpinBox.backendValue === undefined ||
doubleSpinBox.backendValue === null || doubleSpinBox.backendValue.value === undefined)
? .0 : doubleSpinBox.backendValue.value;
property real valueFromBackend: doubleSpinBox.backendValue.value;
onValueFromBackendChanged: {
readingFromBackend = true;
......@@ -94,7 +92,6 @@ QWidget { //This is a special doubleSpinBox that does color coding for states
}
onValueChanged: {
if (doubleSpinBox.backendValue != null && readingFromBackend == false)
doubleSpinBox.backendValue.value = value;
}
......@@ -112,9 +109,7 @@ QWidget { //This is a special doubleSpinBox that does color coding for states
}
ExtendedFunctionButton {
backendValue: (doubleSpinBox.backendValue === undefined ||
doubleSpinBox.backendValue === null)
? null : doubleSpinBox.backendValue;
backendValue: doubleSpinBox.backendValue;
y: box.y + 4
x: box.x + 2
visible: doubleSpinBox.enabled
......
......@@ -30,16 +30,18 @@ QWidget { //This is a special spinBox that does color coding for states
Script {
function evaluate() {
if (backendValue === undefined)
return;
if (!enabled) {
box.setStyleSheet("color: "+scheme.disabledColor);
} else {
if (baseStateFlag) {
if (backendValue != null && backendValue.isInModel)
if (!(baseStateFlag === undefined) && baseStateFlag) {
if (backendValue.isInModel)
box.setStyleSheet("color: "+scheme.changedBaseColor);
else
box.setStyleSheet("color: "+scheme.defaultColor);
} else {
if (backendValue != null && backendValue.isInSubState)
if (backendValue.isInSubState)
box.setStyleSheet("color: "+scheme.changedStateColor);
else
box.setStyleSheet("color: "+scheme.defaultColor);
......@@ -48,13 +50,13 @@ QWidget { //This is a special spinBox that does color coding for states
}
}
property bool isInModel: (backendValue === undefined || backendValue === null) ? false: backendValue.isInModel;
property bool isInModel: backendValue.isInModel;
onIsInModelChanged: {
evaluate();
}
property bool isInSubState: (backendValue === undefined || backendValue === null) ? false: backendValue.isInSubState;
property bool isInSubState: backendValue.isInSubState;
onIsInSubStateChanged: {
evaluate();
......@@ -68,21 +70,18 @@ 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
enabled: backendValue.isBound
property bool readingFromBackend: false;
property int valueFromBackend: (spinBox.backendValue === undefined || spinBox.backendValue == null || spinBox.backendValue.value === undefined)
? .0 : spinBox.backendValue.value;
property int valueFromBackend: spinBox.backendValue.value;
onValueFromBackendChanged: {
readingFromBackend = true;
if (!(valueFromBackend === undefined))
readingFromBackend = true;
value = valueFromBackend;
readingFromBackend = false;
evaluate();
}
onValueChanged: {
if (spinBox.backendValue != null && readingFromBackend == false)
onValueChanged: {
backendValue.value = value;
}
......@@ -99,9 +98,7 @@ QWidget { //This is a special spinBox that does color coding for states
}
ExtendedFunctionButton {
backendValue: (spinBox.backendValue === undefined ||
spinBox.backendValue === null)
? null : spinBox.backendValue;
backendValue: spinBox.backendValue;
y: box.y + 4
x: box.x + 2
visible: spinBox.enabled
......
......@@ -20,7 +20,7 @@ QFrame {
id: standardMode;
toolTip: "special properties";
//iconFromFile: "images/rect-icon.png";
text: backendValues.className.value
text: backendValues === undefined ? "empty" : backendValues.className.value
onClicked: {
extendedMode.checked = false;
layoutMode.checked = false;
......
......@@ -75,7 +75,7 @@ GroupBox {
}
IntEditor {
backendValue: backendValues.z == undefined ? 0 : backendValues.z
backendValue: backendValues.z
caption: "z"
baseStateFlag: isBaseState;
step: 1;
......
......@@ -32,11 +32,11 @@ GroupBox {
}
QLineEdit {
enabled: baseStateFlag
enabled: isBaseState
id: idLineEdit;
objectName: "idLineEdit";
readOnly: isBaseState != true;
text: backendValues.id === undefined ? "" : backendValues.id.value;
text: backendValues.id.value;
onEditingFinished: {
backendValues.id.value = text;
}
......
......@@ -14,18 +14,17 @@ GroupBox {
Label {
text: "Visibility"
}
CheckBox {
id: visibleCheckBox;
text: "Is visible";
backendValue: backendValues.visible === undefined ? false : backendValues.visible;
backendValue: backendValues.visible;
baseStateFlag: isBaseState;
checkable: true;
}
CheckBox {
id: clipCheckBox;
text: "Clip Content";
backendValue: backendValues.clip === undefined ? false : backendValues.clip;
backendValue: backendValues.clip;
baseStateFlag: isBaseState;
checkable: true;
}
......@@ -41,7 +40,7 @@ GroupBox {
DoubleSpinBox {
text: ""
id: opacitySpinBox;
backendValue: backendValues.opacity === undefined ? null : backendValues.opacity
backendValue: backendValues.opacity
property var backendValueValue: backendValues.opacity.value;
minimumWidth: 60;
minimum: 0;
......@@ -57,9 +56,8 @@ GroupBox {
minimum: 0
maximum: 100
singleStep: 5;
backendValue: backendValues.opacity === undefined ? null : backendValues.opacity
backendValue: backendValues.opacity
onValueChanged: {
if (backendValues.opacity !== undefined)
backendValues.opacity.value = value / 100;
}
}
......
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