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
|
|
|
|
2010-02-05 15:42:31 +10:00
|
|
|
QWidget { //This is a special checkBox that does color coding for states
|
2010-01-07 12:14:35 +01:00
|
|
|
|
2010-02-05 15:42:31 +10:00
|
|
|
id: checkBox;
|
2010-01-07 12:14:35 +01:00
|
|
|
|
2010-02-04 12:57:57 +01:00
|
|
|
property var backendValue;
|
2010-01-07 12:14:35 +01:00
|
|
|
|
2010-02-04 12:57:57 +01:00
|
|
|
property var baseStateFlag;
|
2010-02-05 15:42:31 +10:00
|
|
|
property alias checkable: localCheckBox.checkable
|
|
|
|
|
property alias text: localLabel.text
|
2010-01-07 12:14:35 +01:00
|
|
|
|
2010-02-04 12:57:57 +01:00
|
|
|
onBaseStateFlagChanged: {
|
2010-01-07 12:14:35 +01:00
|
|
|
evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-04 12:57:57 +01:00
|
|
|
onBackendValueChanged: {
|
|
|
|
|
evaluate();
|
|
|
|
|
}
|
2010-02-25 16:48:20 +01:00
|
|
|
|
2010-03-15 16:24:04 +01:00
|
|
|
property bool isInModel: backendValue.isInModel;
|
2010-02-04 12:57:57 +01:00
|
|
|
|
|
|
|
|
onIsInModelChanged: {
|
|
|
|
|
evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-15 16:24:04 +01:00
|
|
|
property bool isInSubState: backendValue.isInSubState;
|
2010-02-04 12:57:57 +01:00
|
|
|
|
|
|
|
|
onIsInSubStateChanged: {
|
|
|
|
|
evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-23 10:02:49 +01:00
|
|
|
function evaluate() {
|
|
|
|
|
if (!enabled) {
|
|
|
|
|
localLabel.setStyleSheet("color: "+scheme.disabledColor);
|
|
|
|
|
} else {
|
|
|
|
|
if (baseStateFlag) {
|
|
|
|
|
if (backendValue.isInModel)
|
|
|
|
|
localLabel.setStyleSheet("color: "+scheme.changedBaseColor);
|
|
|
|
|
else
|
|
|
|
|
localLabel.setStyleSheet("color: "+scheme.boldTextColor);
|
2010-01-08 17:17:48 +01:00
|
|
|
} else {
|
2010-03-23 10:02:49 +01:00
|
|
|
if (backendValue.isInSubState)
|
|
|
|
|
localLabel.setStyleSheet("color: "+scheme.changedStateColor);
|
|
|
|
|
else
|
|
|
|
|
localLabel.setStyleSheet("color: "+scheme.boldTextColor);
|
2010-01-08 17:17:48 +01:00
|
|
|
}
|
2010-02-04 12:57:57 +01:00
|
|
|
}
|
|
|
|
|
}
|
2010-02-25 16:48:20 +01:00
|
|
|
|
|
|
|
|
ColorScheme { id:scheme; }
|
2010-02-04 12:57:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
layout: HorizontalLayout {
|
|
|
|
|
spacing: 4
|
|
|
|
|
|
|
|
|
|
QCheckBox {
|
2010-02-05 15:42:31 +10:00
|
|
|
id: localCheckBox
|
2010-02-04 12:57:57 +01:00
|
|
|
checkable: true;
|
2010-03-15 16:24:04 +01:00
|
|
|
checked: backendValue.value;
|
2010-02-04 12:57:57 +01:00
|
|
|
onToggled: {
|
|
|
|
|
backendValue.value = checked;
|
|
|
|
|
}
|
2010-02-25 16:48:20 +01:00
|
|
|
maximumWidth: 30
|
2010-02-04 12:57:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QLabel {
|
2010-02-05 15:42:31 +10:00
|
|
|
id: localLabel
|
2010-02-04 12:57:57 +01:00
|
|
|
font.bold: true;
|
2010-02-25 16:48:20 +01:00
|
|
|
alignment: "Qt::AlignLeft | Qt::AlignVCenter"
|
2010-02-04 12:57:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExtendedFunctionButton {
|
2010-02-05 15:42:31 +10:00
|
|
|
backendValue: checkBox.backendValue
|
2010-02-04 12:57:57 +01:00
|
|
|
y: 4
|
2010-02-05 15:42:31 +10:00
|
|
|
x: localCheckBox.x + 18;
|
2010-01-27 18:38:09 +01:00
|
|
|
}
|
2010-01-07 12:14:35 +01:00
|
|
|
}
|
2010-02-04 12:57:57 +01:00
|
|
|
|