2010-01-27 18:38:09 +01:00
|
|
|
import Qt 4.6
|
|
|
|
|
import Bauhaus 1.0
|
|
|
|
|
|
|
|
|
|
QWidget {
|
2010-02-05 15:42:31 +10:00
|
|
|
id: lineEdit
|
2010-01-27 18:38:09 +01:00
|
|
|
|
|
|
|
|
property var backendValue
|
2010-02-05 15:42:31 +10:00
|
|
|
property alias enabled: lineEdit.enabled
|
2010-02-25 16:48:20 +01:00
|
|
|
property var baseStateFlag
|
2010-02-26 15:20:34 +01:00
|
|
|
property alias text: lineEditWidget.text
|
2010-01-27 18:38:09 +01:00
|
|
|
|
|
|
|
|
minimumHeight: 24;
|
|
|
|
|
|
2010-02-26 15:20:34 +01:00
|
|
|
onBaseStateFlagChanged: {
|
|
|
|
|
evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
property var isEnabled: comboBox.enabled
|
|
|
|
|
onIsEnabledChanged: {
|
|
|
|
|
evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-25 16:48:20 +01:00
|
|
|
Script {
|
|
|
|
|
function evaluate() {
|
|
|
|
|
if (!enabled) {
|
|
|
|
|
lineEditWidget.setStyleSheet("color: "+scheme.disabledColor);
|
|
|
|
|
} else {
|
|
|
|
|
if (baseStateFlag) {
|
|
|
|
|
if (backendValue != null && backendValue.isInModel)
|
|
|
|
|
lineEditWidget.setStyleSheet("color: "+scheme.changedBaseColor);
|
|
|
|
|
else
|
|
|
|
|
lineEditWidget.setStyleSheet("color: "+scheme.defaultColor);
|
|
|
|
|
} else {
|
|
|
|
|
if (backendValue != null && backendValue.isInSubState)
|
|
|
|
|
lineEditWidget.setStyleSheet("color: "+scheme.changedStateColor);
|
|
|
|
|
else
|
|
|
|
|
lineEditWidget.setStyleSheet("color: "+scheme.defaultColor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ColorScheme { id:scheme; }
|
|
|
|
|
|
2010-01-27 18:38:09 +01:00
|
|
|
QLineEdit {
|
|
|
|
|
id: lineEditWidget
|
2010-02-25 16:48:20 +01:00
|
|
|
styleSheet: "padding-left: 16;"
|
2010-02-05 15:42:31 +10:00
|
|
|
width: lineEdit.width
|
|
|
|
|
height: lineEdit.height
|
2010-01-27 18:38:09 +01:00
|
|
|
|
|
|
|
|
text: backendValue.value
|
|
|
|
|
|
|
|
|
|
onTextEdited: {
|
|
|
|
|
backendValue.value = text
|
2010-02-26 15:20:34 +01:00
|
|
|
evaluate();
|
2010-01-27 18:38:09 +01:00
|
|
|
}
|
2010-02-25 16:48:20 +01:00
|
|
|
|
|
|
|
|
onFocusChanged: {
|
|
|
|
|
if (focus)
|
|
|
|
|
backendValue.lock();
|
|
|
|
|
else
|
|
|
|
|
backendValue.unlock();
|
|
|
|
|
}
|
2010-01-27 18:38:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
ExtendedFunctionButton {
|
2010-02-05 15:42:31 +10:00
|
|
|
backendValue: lineEdit.backendValue
|
2010-01-27 18:38:09 +01:00
|
|
|
y: 4
|
|
|
|
|
x: 3
|
2010-02-05 15:42:31 +10:00
|
|
|
visible: lineEdit.enabled
|
2010-01-27 18:38:09 +01:00
|
|
|
}
|
|
|
|
|
}
|