diff options
author | Christiaan Janssen <christiaan.janssen@nokia.com> | 2010-02-25 16:48:20 +0100 |
---|---|---|
committer | Christiaan Janssen <christiaan.janssen@nokia.com> | 2010-02-25 16:59:01 +0100 |
commit | e22e3db45c234838e1928babfde3707dbe459068 (patch) | |
tree | bd9a13db872306bb162486a85b5cc4f0c72ce8c2 /share | |
parent | 5aab6ec7b953d353876490fc198699e2d17adac9 (diff) | |
download | qt-creator-e22e3db45c234838e1928babfde3707dbe459068.tar.gz |
QmlDesigner.PropertyEditor: Changing color scheme for the properties
Diffstat (limited to 'share')
13 files changed, 210 insertions, 108 deletions
diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/CheckBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/CheckBox.qml index 0d1601ec4e..f5b73c514f 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/CheckBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/CheckBox.qml @@ -18,8 +18,8 @@ QWidget { //This is a special checkBox that does color coding for states onBackendValueChanged: { evaluate(); } - - property bool isInModel: (backendValue === undefined || backendValue === null) ? false: backendValue.isInModel; + + property bool isInModel: (backendValue === undefined || backendValue === null) ? false: backendValue.isInModel; onIsInModelChanged: { evaluate(); @@ -31,23 +31,27 @@ QWidget { //This is a special checkBox that does color coding for states evaluate(); } - Script { function evaluate() { - if (baseStateFlag) { - if (backendValue != null && backendValue.isInModel) - localLabel.setStyleSheet("color: white;"); - else - localLabel.setStyleSheet("color: gray;"); + if (!enabled) { + localLabel.setStyleSheet("color: "+scheme.disabledColor); } else { - if (backendValue != null && backendValue.isInSubState) - localLabel.setStyleSheet("color: #7799FF;"); - else - localLabel.setStyleSheet("color: gray;"); + if (baseStateFlag) { + if (backendValue != null && backendValue.isInModel) + localLabel.setStyleSheet("color: "+scheme.changedBaseColor); + else + localLabel.setStyleSheet("color: "+scheme.defaultColor); + } else { + if (backendValue != null && backendValue.isInSubState) + localLabel.setStyleSheet("color: "+scheme.changedStateColor); + else + localLabel.setStyleSheet("color: "+scheme.defaultColor); + } } } } - + + ColorScheme { id:scheme; } layout: HorizontalLayout { @@ -56,17 +60,17 @@ 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 || null; + checked: (backendValue === undefined || backendValue === null) ? false : backendValue.value; onToggled: { backendValue.value = checked; } - maximumWidth: 30 + maximumWidth: 30 } QLabel { id: localLabel font.bold: true; - alignment: "Qt::AlignLeft | Qt::AlignVCenter" + alignment: "Qt::AlignLeft | Qt::AlignVCenter" } } diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/ComboBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/ComboBox.qml index 07e6b1261b..8b71c80c61 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/ComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/ComboBox.qml @@ -1,15 +1,67 @@ import Qt 4.6 import Bauhaus 1.0 -QComboBox { - id: comboBox - - property var backendValue - - ExtendedFunctionButton { - backendValue: (comboBox.backendValue === undefined || comboBox.backendValue === null) - ? null : comboBox.backendValue; - y: 3 - x: 3 +QWidget { + + id: comboBox + + property var backendValue + property var baseStateFlag; + property alias enabled: comboBox.enabled + + property var items + property var currentText + + + onBaseStateFlagChanged: { + evaluate(); + } + + onBackendValueChanged: { + evaluate(); + } + + property var isEnabled: comboBox.enabled + onIsEnabledChanged: { + evaluate(); + } + + + + Script { + function evaluate() { + if (!enabled) { + box.setStyleSheet("color: "+scheme.disabledColor); + } else { + if (baseStateFlag) { + if (backendValue != null && backendValue.isInModel) + box.setStyleSheet("QComboBox{color: "+scheme.changedBaseColor+"}QComboBox:on{color:white}"); + else + box.setStyleSheet("QComboBox{color: "+scheme.defaultColor+"}QComboBox:on{color:white}"); + } else { + if (backendValue != null && backendValue.isInSubState) + box.setStyleSheet("QComboBox{color: "+scheme.changedStateColor+"}QComboBox:on{color:white}"); + else + box.setStyleSheet("QComboBox{color: "+scheme.defaultColor+"}QComboBox:on{color:white}"); + } + } + } + } + + ColorScheme { id:scheme; } + + layout: HorizontalLayout { + QComboBox { + id: box + property var backendValue: comboBox.backendValue + items: comboBox.items + currentText: comboBox.currentText + ExtendedFunctionButton { + backendValue: (comboBox.backendValue === undefined || comboBox.backendValue === null) + ? null : comboBox.backendValue; + y: 3 + x: 3 + } } + } } diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/DoubleSpinBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/DoubleSpinBox.qml index 82e264b811..c8a8ba0be3 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/DoubleSpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/DoubleSpinBox.qml @@ -10,9 +10,9 @@ QWidget { //This is a special doubleSpinBox that does color coding for states property alias singleStep: box.singleStep property alias minimum: box.minimum property alias maximum: box.maximum - property alias spacing: layoutH.spacing + property alias spacing: layoutH.spacing property alias text: label.text - property bool alignRight: true + property bool alignRight: true property bool enabled: true minimumHeight: 22; @@ -25,22 +25,28 @@ QWidget { //This is a special doubleSpinBox that does color coding for states evaluate(); } - Script { + Script { function evaluate() { - if (baseStateFlag) { - if (backendValue != null && backendValue.isInModel) - box.setStyleSheet("color: white;"); - else - box.setStyleSheet("color: gray;"); - } else { - if (backendValue != null && backendValue.isInSubState) - box.setStyleSheet("color: #7799FF;"); - else - box.setStyleSheet("color: gray;"); - } + if (!enabled) { + box.setStyleSheet("color: "+scheme.disabledColor); + } else { + if (baseStateFlag) { + if (backendValue != null && backendValue.isInModel) + box.setStyleSheet("color: "+scheme.changedBaseColor); + else + box.setStyleSheet("color: "+scheme.defaultColor); + } else { + if (backendValue != null && backendValue.isInSubState) + box.setStyleSheet("color: "+scheme.changedStateColor); + else + box.setStyleSheet("color: "+scheme.defaultColor); + } + } } } + ColorScheme { id:scheme; } + property bool isInModel: (backendValue === undefined || backendValue === null) ? false: backendValue.isInModel; onIsInModelChanged: { @@ -54,7 +60,7 @@ QWidget { //This is a special doubleSpinBox that does color coding for states } layout: HorizontalLayout { - id: layoutH; + id: layoutH; QLabel { id: label; @@ -69,12 +75,12 @@ QWidget { //This is a special doubleSpinBox that does color coding for states decimals: 1; keyboardTracking: false; enabled: (doubleSpinBox.backendValue === undefined || - doubleSpinBox.backendValue === null) + doubleSpinBox.backendValue === null) ? true : !backendValue.isBound && doubleSpinBox.enabled; property bool readingFromBackend: false; property real valueFromBackend: (doubleSpinBox.backendValue === undefined || - doubleSpinBox.backendValue === null || doubleSpinBox.backendValue.value === undefined) + doubleSpinBox.backendValue === null || doubleSpinBox.backendValue.value === undefined) ? .0 : doubleSpinBox.backendValue.value; onValueFromBackendChanged: { @@ -85,26 +91,26 @@ QWidget { //This is a special doubleSpinBox that does color coding for states onValueChanged: { if (doubleSpinBox.backendValue != null && readingFromBackend == false) - doubleSpinBox.backendValue.value = value; + doubleSpinBox.backendValue.value = value; } onMouseOverChanged: { } - - onFocusChanged: { - if (focus) - doubleSpinBox.backendValue.lock(); - else - doubleSpinBox.backendValue.unlock(); - } + + onFocusChanged: { + if (focus) + doubleSpinBox.backendValue.lock(); + else + doubleSpinBox.backendValue.unlock(); + } } } ExtendedFunctionButton { backendValue: (doubleSpinBox.backendValue === undefined || - doubleSpinBox.backendValue === null) - ? null : doubleSpinBox.backendValue; + doubleSpinBox.backendValue === null) + ? null : doubleSpinBox.backendValue; y: box.y + 4 x: box.x + 2 visible: doubleSpinBox.enabled diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/FontGroupBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/FontGroupBox.qml index 6bbf7c5b63..77d86a21c7 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/FontGroupBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/FontGroupBox.qml @@ -60,6 +60,8 @@ GroupBox { } ComboBox { + baseStateFlag:isBaseState + backendValue: backendValues.style items : { ["Normal", "Outline", "Raised", "Sunken"] } currentText: backendValues.style.value; onItemsChanged: { diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/IntEditor.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/IntEditor.qml index 6dcddbde87..ffb421fcf6 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/IntEditor.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/IntEditor.qml @@ -18,12 +18,12 @@ QWidget { layout: HorizontalLayout { Label { id: label - text: caption + text: caption } SpinBox { backendValue: (intEditor.backendValue === undefined || - intEditor.backendValue === null) + intEditor.backendValue === null) ? null : intEditor.backendValue; property var backendValueValue: (intEditor.backendValue === undefined || @@ -36,6 +36,7 @@ QWidget { minimum: minimumValue maximum: maximumValue + baseStateFlag: intEditor.baseStateFlag } @@ -53,21 +54,23 @@ QWidget { minimum: minimumValue maximum: maximumValue singleStep: step - - + + + value: (backendValue == undefined + || backendValue == null + || backendValue.value == undefined + || backendValue.value == null) ? 0 : backendValue.value onValueChanged: { if (backendValue != undefined && backendValue != null) - backendValue.value = value; + backendValue.value = value; } - - - onSliderPressed: { - backendValue.lock(); - } - onSliderReleased: { - backendValue.unlock(); - } + onSliderPressed: { + backendValue.lock(); + } + onSliderReleased: { + backendValue.unlock(); + } } } } diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/Label.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/Label.qml index f5d267efde..c3af2d8b6d 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/Label.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/Label.qml @@ -1,10 +1,10 @@ import Qt 4.6 import Bauhaus 1.0 -QLabel { +QLabel { id: label - font.bold: true; - alignment: "Qt::AlignRight | Qt::AlignVCenter" + font.bold: true; + alignment: "Qt::AlignRight | Qt::AlignVCenter" fixedWidth: 90 } diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/Layout.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/Layout.qml index 3065fb251a..21f2b95eb8 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/Layout.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/Layout.qml @@ -52,7 +52,7 @@ GroupBox { } QWidget { - layout : HorizontalLayout { + layout : HorizontalLayout { IntEditor { slider: false caption: "Margin" diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/LayoutPane.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/LayoutPane.qml index 838c19af12..122659001e 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/LayoutPane.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/LayoutPane.qml @@ -9,17 +9,17 @@ QScrollArea { visible: false; content: properyEditorLayout; QFrame { - enabled: isBaseState; id: properyEditorLayout; + enabled: isBaseState minimumHeight: 460; layout: QVBoxLayout { topMargin: 0; bottomMargin: 0; leftMargin: 0; - rightMargin: 0; + rightMargin: 0; Layout { id: layoutBox; - } + } QScrollArea { } } diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/LineEdit.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/LineEdit.qml index 4676663ab4..59cd622785 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/LineEdit.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/LineEdit.qml @@ -6,12 +6,35 @@ QWidget { property var backendValue property alias enabled: lineEdit.enabled + property var baseStateFlag minimumHeight: 24; + 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; } + QLineEdit { id: lineEditWidget - styleSheet: "padding-left: 16;" + styleSheet: "padding-left: 16;" width: lineEdit.width height: lineEdit.height @@ -20,13 +43,13 @@ QWidget { onTextEdited: { backendValue.value = text } - - onFocusChanged: { - if (focus) - backendValue.lock(); - else - backendValue.unlock(); - } + + onFocusChanged: { + if (focus) + backendValue.lock(); + else + backendValue.unlock(); + } } diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/Modifiers.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/Modifiers.qml index e3143ce902..f5ec2def1c 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/Modifiers.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/Modifiers.qml @@ -74,8 +74,10 @@ GroupBox { } ComboBox { minimumWidth: 20 + baseStateFlag: isBaseState - backendValue: backendValues.transformOrigin + backendValue: backendValues.transformOrigin + items : { [ "TopLeft", "Top", "TopRight", "Left", "Center", "Right", "BottomLeft", "Bottom", "BottomRight" diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml index 0013d2e524..c2ad6ef76e 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml @@ -22,22 +22,30 @@ QWidget { //This is a special spinBox that does color coding for states evaluate(); } + property var isEnabled: spinBox.enabled + onIsEnabledChanged: { + evaluate(); + } + Script { - function evaluate() { - if (baseStateFlag) { - if (backendValue != null && backendValue.isInModel) - box.setStyleSheet("color: white;"); - else - box.setStyleSheet("color: gray;"); + if (!enabled) { + box.setStyleSheet("color: "+scheme.disabledColor); + } else { + if (baseStateFlag) { + if (backendValue != null && backendValue.isInModel) + box.setStyleSheet("color: "+scheme.changedBaseColor); + else + box.setStyleSheet("color: "+scheme.defaultColor); } else { - if (backendValue != null && backendValue.isInSubState) - box.setStyleSheet("color: #7799FF;"); - else - box.setStyleSheet("color: gray;"); + if (backendValue != null && backendValue.isInSubState) + box.setStyleSheet("color: "+scheme.changedStateColor); + else + box.setStyleSheet("color: "+scheme.defaultColor); } } } + } property bool isInModel: (backendValue === undefined || backendValue === null) ? false: backendValue.isInModel; @@ -51,8 +59,10 @@ QWidget { //This is a special spinBox that does color coding for states evaluate(); } + ColorScheme { id:scheme; } + layout: HorizontalLayout { - + QSpinBox { property alias backendValue: spinBox.backendValue @@ -74,24 +84,23 @@ QWidget { //This is a special spinBox that does color coding for states onValueChanged: { if (spinBox.backendValue != null && readingFromBackend == false) backendValue.value = value; - } - - onFocusChanged: { - if (focus) - spinBox.backendValue.lock(); - else - spinBox.backendValue.unlock(); - } - - onEditingFinished: { - focus = false; - } + } + + onFocusChanged: { + if (focus) + spinBox.backendValue.lock(); + else + spinBox.backendValue.unlock(); + } + onEditingFinished: { + focus = false; + } } } - ExtendedFunctionButton { + ExtendedFunctionButton { backendValue: (spinBox.backendValue === undefined || - spinBox.backendValue === null) + spinBox.backendValue === null) ? null : spinBox.backendValue; y: box.y + 4 x: box.x + 2 diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/StandardTextGroupBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/StandardTextGroupBox.qml index 48e7866f50..6dc33856ca 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/StandardTextGroupBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/StandardTextGroupBox.qml @@ -18,6 +18,7 @@ GroupBox { LineEdit { backendValue: backendValues.text + baseStateFlag: isBaseState; } } } diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/Type.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/Type.qml index e99f51ab2f..1bf3e44638 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/Type.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/Type.qml @@ -12,7 +12,7 @@ GroupBox { layout: HorizontalLayout { Label { text: "type"; - windowTextColor: isBaseState ? "#000000" : "#FF0000"; + windowTextColor: isBaseState ? "#000000" : "#FF0000"; } QLabel { |