Commit e22e3db4 authored by Christiaan Janssen's avatar Christiaan Janssen

QmlDesigner.PropertyEditor: Changing color scheme for the properties

parent 5aab6ec7
......@@ -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"
}
}
......
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
}
}
}
}
......@@ -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
......
......@@ -60,6 +60,8 @@ GroupBox {
}
ComboBox {
baseStateFlag:isBaseState
backendValue: backendValues.style
items : { ["Normal", "Outline", "Raised", "Sunken"] }
currentText: backendValues.style.value;
onItemsChanged: {
......
......@@ -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();
}
}
}
}
......
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
}
......@@ -52,7 +52,7 @@ GroupBox {
}
QWidget {
layout : HorizontalLayout {
layout : HorizontalLayout {
IntEditor {
slider: false
caption: "Margin"
......
......@@ -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 {
}
}
......
......@@ -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();
}
}
......
......@@ -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"
......
......@@ -22,21 +22,29 @@ 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
......
......@@ -18,6 +18,7 @@ GroupBox {
LineEdit {
backendValue: backendValues.text
baseStateFlag: isBaseState;
}
}
}
......
......@@ -12,7 +12,7 @@ GroupBox {
layout: HorizontalLayout {
Label {
text: "type";
windowTextColor: isBaseState ? "#000000" : "#FF0000";
windowTextColor: isBaseState ? "#000000" : "#FF0000";
}
QLabel {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment