2010-01-07 12:14:35 +01:00
|
|
|
import Qt 4.6
|
2010-01-29 16:38:34 +01:00
|
|
|
import Bauhaus 1.0
|
2010-01-07 12:14:35 +01:00
|
|
|
|
|
|
|
|
QCheckBox { //This is a special CheckBox that does color coding for states
|
|
|
|
|
id: CheckBox;
|
|
|
|
|
|
|
|
|
|
property var backendValue;
|
|
|
|
|
property var baseStateFlag;
|
|
|
|
|
|
|
|
|
|
checkable: true;
|
2010-01-28 17:47:15 +01:00
|
|
|
checked: (backendValue === undefined || backendValue === null) ? false : backendValue.value;
|
|
|
|
|
onToggled: {
|
|
|
|
|
backendValue.value = checked;
|
|
|
|
|
}
|
2010-01-07 12:14:35 +01:00
|
|
|
|
|
|
|
|
onBaseStateFlagChanged: {
|
|
|
|
|
evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onBackendValueChanged: {
|
|
|
|
|
evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Script {
|
|
|
|
|
function evaluate() {
|
2010-01-08 17:17:48 +01:00
|
|
|
if (baseStateFlag) {
|
|
|
|
|
if (backendValue != null && backendValue.isInModel)
|
2010-01-07 12:14:35 +01:00
|
|
|
CheckBox.setStyleSheet("color: white;");
|
2010-01-08 17:17:48 +01:00
|
|
|
else
|
|
|
|
|
CheckBox.setStyleSheet("color: gray;");
|
|
|
|
|
} else {
|
|
|
|
|
if (backendValue != null && backendValue.isInSubState)
|
|
|
|
|
CheckBox.setStyleSheet("color: #7799FF;");
|
|
|
|
|
else
|
|
|
|
|
CheckBox.setStyleSheet("color: gray;");
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-01-07 12:14:35 +01:00
|
|
|
}
|
2010-01-27 18:38:09 +01:00
|
|
|
|
|
|
|
|
ExtendedFunctionButton {
|
|
|
|
|
backendValue: CheckBox.backendValue
|
|
|
|
|
y: 2
|
|
|
|
|
x: 0
|
|
|
|
|
}
|
2010-01-07 12:14:35 +01:00
|
|
|
}
|