diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/FontComboBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/FontComboBox.qml new file mode 100644 index 0000000000000000000000000000000000000000..e10124fce68a9368c8c54974ff9c2c950c8acbe0 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/FontComboBox.qml @@ -0,0 +1,68 @@ +import Qt 4.6 +import Bauhaus 1.0 + +QWidget { + id: fontComboBox + + property alias currentFont: fontSelector.currentFont + property var backendValue + property var baseStateFlag; + property alias enabled: fontSelector.enabled + + onBaseStateFlagChanged: { + evaluate(); + } + + onBackendValueChanged: { + evaluate(); + } + + property var isEnabled: fontComboBox.enabled + onIsEnabledChanged: { + evaluate(); + } + + + Script { + function evaluate() { + if (!enabled) { + fontSelector.setStyleSheet("color: "+scheme.disabledColor); + } else { + if (baseStateFlag) { + if (backendValue != null && backendValue.isInModel) + fontSelector.setStyleSheet("QComboBox,QComboBox:on{color: "+scheme.changedBaseColor+"}QComboBox:off{color:"+scheme.optionsColor+"}"); + else + fontSelector.setStyleSheet("QComboBox,QComboBox:on{color: "+scheme.defaultColor+"}QComboBox:off{color:"+scheme.optionsColor+"}"); + } else { + if (backendValue != null && backendValue.isInSubState) + fontSelector.setStyleSheet("QComboBox,QComboBox:on{color: "+scheme.changedStateColor+"}QComboBox:off{color:"+scheme.optionsColor+"}"); + else + fontSelector.setStyleSheet("QComboBox,QComboBox:on{color: "+scheme.defaultColor+"}QComboBox:off{color:"+scheme.optionsColor+"}"); + } + } + } + } + + property bool isInModel: (backendValue === undefined || backendValue === null) ? false: backendValue.isInModel; + + onIsInModelChanged: { + evaluate(); + } + + property bool isInSubState: (backendValue === undefined || backendValue === null) ? false: backendValue.isInSubState; + + onIsInSubStateChanged: { + evaluate(); + } + + ColorScheme { id:scheme; } + + layout: HorizontalLayout { + QFontComboBox { + id: fontSelector + // currentFont.family:backendValues.font_family.value + // onCurrentFontChanged: if (backendValues.font_family.value != currentFont.family) + // backendValues.font_family.value = currentFont.family; + } + } +} diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/FontGroupBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/FontGroupBox.qml index e3f2e4672aba45069478ccf628fcda48b380470d..7b272359803fd509acc2d6669e2b326dae93ac0c 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/FontGroupBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/FontGroupBox.qml @@ -13,11 +13,14 @@ GroupBox { Label { text: "Font" } - QFontComboBox { + FontComboBox { id: fontSelector currentFont.family:backendValues.font_family.value onCurrentFontChanged: if (backendValues.font_family.value != currentFont.family) backendValues.font_family.value = currentFont.family; + + backendValue:backendValues.font_family + baseStateFlag: isBaseState } } }