Commit a47cfaa0 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.PropertyEditor: Refactoring and polishing

I polished and refactored most of the property editor (again)
I introduced more custom widgets with expression editing, fixed bugs
and polished the visual design
parent 134fc795
......@@ -4,31 +4,26 @@ import Bauhaus 1.0
GroupBox {
maximumHeight: 240;
finished: finishedNotify;
caption: "Image";
layout: QVBoxLayout {
topMargin: 12;
bottomMargin: 12;
leftMargin: 12;
rightMargin: 12;
layout: VerticalLayout {
FileWidget {
enabled: isBaseState || backendValues.id.value != "";
maximumWidth: 250;
text: "Source: ";
text: "Source";
fileName: backendValues.source.value;
onFileNameChanged: {
backendValues.source.value = fileName;
}
}
}
IntEditor {
id: pixelSize;
backendValue: backendValues.border_left;
caption: "Border Left: "
caption: "Left"
baseStateFlag: isBaseState;
step: 1;
......@@ -38,7 +33,7 @@ GroupBox {
IntEditor {
backendValue: backendValues.border_right;
caption: "Border Right: "
caption: "Right"
baseStateFlag: isBaseState;
step: 1;
......@@ -48,7 +43,7 @@ GroupBox {
IntEditor {
backendValue: backendValues.border_top;
caption: "Border Top: "
caption: "Top"
baseStateFlag: isBaseState;
step: 1;
......@@ -58,7 +53,7 @@ GroupBox {
IntEditor {
backendValue: backendValues.border_bottom;
caption: "Border Bottom:"
caption: "Bottom"
baseStateFlag: isBaseState;
step: 1;
......
......@@ -35,4 +35,11 @@ QCheckBox { //This is a special CheckBox that does color coding for states
}
}
}
ExtendedFunctionButton {
backendValue: CheckBox.backendValue
y: 2
x: 0
visible: CheckBox.enabled
}
}
import Qt 4.6
import Bauhaus 1.0
QComboBox {
id: ComboBox
property var backendValue
ExtendedFunctionButton {
backendValue: ComboBox.backendValue
y: 3
x: 3
visible: CheckBox.enabled
}
}
\ No newline at end of file
......@@ -55,7 +55,9 @@ QWidget { //This is a special DoubleSpinBox that does color coding for states
QLabel {
visible: text != ""
id: label;
font.bold: true;
alignment: "Qt::AlignRight | Qt::AlignVCenter"
maximumWidth: 80
}
QDoubleSpinBox {
......
......@@ -13,6 +13,8 @@ QWidget {
onActiveChanged: {
//text = "";
print("active")
print(y)
if (active) {
textEdit.plainText = backendValue.expression
textEdit.setFocus();
......
......@@ -14,10 +14,8 @@ layout: VerticalLayout{
QWidget {
maximumHeight: 40;
layout: HorizontalLayout {
QLabel {
text: "Effect ";
font.bold: true;
alignment: "Qt::AlignRight | Qt::AlignVCenter"
Label {
text: "Effect ";
}
QComboBox {
enabled: isBaseState;
......
......@@ -74,7 +74,7 @@ QToolButton {
QAction {
text: "Set Expression";
onTriggered: {
expressionEdit.globalY = box.globalY;
expressionEdit.globalY = ExtendedFunctionButton.globalY;
expressionEdit.backendValue = ExtendedFunctionButton.backendValue
expressionEdit.show();
expressionEdit.raise();
......
import Qt 4.6
import Bauhaus 1.0
GroupBox {
id: FontGroupBox
caption: "Font";
layout: VerticalLayout {
QWidget {
layout: HorizontalLayout {
Label {
text: "Font"
}
QFontComboBox {
minimumWidth: 200
}
IntEditor {
caption: "Size"
slider: false
backendValue: backendValues.font_pointSize
baseStateFlag: isBaseState;
}
}
}
QWidget {
layout: HorizontalLayout {
Label {
text: "Style"
}
CheckBox {
text: "Bold";
backendValue: backendValues.font_bold
baseStateFlag: isBaseState;
checkable: true;
}
CheckBox {
text: "Italic";
backendValue: backendValues.font_italic
baseStateFlag: isBaseState;
checkable: true;
}
}
}
}
}
......@@ -5,16 +5,13 @@ GroupBox {
id: Geometry;
caption: "Geometry";
maximumHeight: 240;
layout: VerticalLayout {
QWidget { // 1
layout: HorizontalLayout {
QLabel {
Label {
text: "Position"
alignment: "Qt::AlignRight | Qt::AlignVCenter"
}
DoubleSpinBox {
......@@ -48,9 +45,8 @@ GroupBox {
QWidget {
layout: HorizontalLayout {
QLabel {
Label {
text: "Size"
alignment: "Qt::AlignRight | Qt::AlignVCenter"
}
DoubleSpinBox {
......
......@@ -3,7 +3,7 @@ import Bauhaus 1.0
QHBoxLayout {
id: HorizontalLayout
spacing: 20
spacing: 10
topMargin: 0
bottomMargin: 0
leftMargin: 0
......
......@@ -7,15 +7,10 @@ GroupBox {
finished: finishedNotify;
caption: "Image";
layout: QVBoxLayout {
topMargin: 12;
bottomMargin: 12;
leftMargin: 2;
rightMargin: 2;
layout: VerticalLayout {
FileWidget {
enabled: isBaseState || backendValues.id.value != "";
maximumWidth: 250;
text: "Source: ";
fileName: backendValues.source.value;
onFileNameChanged: {
......
......@@ -13,12 +13,12 @@ QWidget {
property var minimumValue: 0
property var step: 1
property bool slider: true
property alias alignment: label.alignment
layout: HorizontalLayout {
QLabel {
text: caption
font.bold: true;
alignment: "Qt::AlignRight | Qt::AlignVCenter"
Label {
id: label
text: caption
}
SpinBox {
......@@ -32,7 +32,6 @@ QWidget {
QWidget {
visible: IntEditor.slider
id: sliderWidget
fixedWidth: 100
QSlider {
y: sliderWidget.height / 2 - 12
width: sliderWidget.width
......
import Qt 4.6
import Bauhaus 1.0
QLabel {
id: Label
font.bold: true;
alignment: "Qt::AlignRight | Qt::AlignVCenter"
//maximumWidth: 80
fixedWidth: 80
}
import Qt 4.6
import Bauhaus 1.0
QWidget {
id: LineEdit
property var backendValue
minimumHeight: 24;
QLineEdit {
id: lineEditWidget
x: 18
width: LineEdit.width - 18
height: LineEdit.height
text: backendValue.value
onTextEdited: {
print("text edited")
backendValue.value = text
}
}
ExtendedFunctionButton {
backendValue: LineEdit.backendValue
y: 4
x: 3
visible: LineEdit.enabled
}
}
......@@ -11,9 +11,8 @@ GroupBox {
QWidget {
layout: HorizontalLayout {
QLabel {
Label {
text: "Visibility"
alignment: "Qt::AlignRight | Qt::AlignVCenter"
}
CheckBox {
......@@ -29,16 +28,14 @@ GroupBox {
backendValue: backendValues.clip === undefined ? false : backendValues.clip;
baseStateFlag: isBaseState;
checkable: true;
fixedWidth: 100
}
}
}
QWidget {
layout: HorizontalLayout {
QLabel {
Label {
text: "Opacity"
alignment: "Qt::AlignRight | Qt::AlignVCenter"
}
DoubleSpinBox {
......@@ -66,12 +63,13 @@ GroupBox {
QWidget {
layout: HorizontalLayout {
QLabel {
Label {
text: "Origin";
alignment: "Qt::AlignRight | Qt::AlignVCenter"
}
QComboBox {
ComboBox {
minimumWidth: 20
backendValue: backendValues.transformOrigin
items : { [
"TopLeft", "Top", "TopRight", "Left", "Center", "Right", "BottomLeft", "Bottom",
"BottomRight"
......@@ -85,18 +83,13 @@ GroupBox {
backendValues.transformOrigin.value = currentText;
}
}
QWidget {
fixedWidth: 100
}
}
}
QWidget {
layout: HorizontalLayout {
QLabel {
Label {
text: "Scale"
alignment: "Qt::AlignRight | Qt::AlignVCenter"
}
DoubleSpinBox {
......
import Qt 4.6
import Bauhaus 1.0
QWidget {
id: PlaceHolder
fixedWidth: 100
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ import Qt 4.6
WidgetFrame {
id: PropertyFrame;
minimumWidth: 350;
minimumWidth: 320;
//maximumWidth: 300;
styleSheetFile: "propertyEditor.css";
//visible: isBaseState;
......
......@@ -8,16 +8,25 @@ GroupBox {
maximumHeight: 340;
layout: QVBoxLayout {
topMargin: 20;
bottomMargin: 4;
leftMargin: 0;
rightMargin: 10;
layout: VerticalLayout {
IntEditor {
backendValue: backendValues.radius
caption: "Radius"
baseStateFlag: isBaseState;
step: 1;
minimumValue: 0;
maximumValue: 100;
}
IntEditor {
id: borderWidth;
backendValue: backendValues.border_width === undefined ? 0 : backendValues.border_width
caption: "Pen Width"
baseStateFlag: isBaseState;
step: 1;
minimumValue: 0;
maximumValue: 100;
......@@ -32,8 +41,9 @@ GroupBox {
//modelNode: backendValues.color.modelNode;
complexGradientNode: backendValues.color === undefined ? null : backendValues.color.complexNode
showGradientButton: true;
//showGradientButton: true;
}
ColorWidget {
text: "Tint color";
color: backendValues.tintColor === undefined ? "black" : backendValues.tintColor.value
......@@ -42,18 +52,6 @@ GroupBox {
}
}
IntEditor {
id: borderWidth;
backendValue: backendValues.border_width === undefined ? 0 : backendValues.border_width
caption: "Pen Width"
baseStateFlag: isBaseState;
step: 1;
minimumValue: 0;
maximumValue: 100;
}
ColorWidget {
id: PenColor;
text: "Pen Color";
......
......@@ -4,7 +4,7 @@ import Bauhaus 1.0
QWidget {
id: SliderWidget
visible: IntEditor.slider
fixedWidth: 100
//fixedWidth: 100
property alias value: slider.value
property alias singleStep: slider.singleStep
......
import Qt 4.6
import Bauhaus 1.0
GroupBox {
id: StandardTextGroupBox
caption: "Text";
property bool showStyleColor: false;
layout: VerticalLayout {
QWidget {
layout: HorizontalLayout {
Label {
text: "Text"
}
LineEdit {
backendValue: backendValues.text
}
CheckBox {
fixedWidth: 70
baseStateFlag: isBaseState;
text: "Wraps";
checkable: true;
backendValue: backendValues.wrap;
}
}
}
QWidget {
layout: HorizontalLayout {
Label {
text: "Alignment"
}
ComboBox {
items : { ["AlignLeft", "AlignRight", "AlignHCenter"] }
currentText: backendValues.horizontalAlignment.value;
onItemsChanged: {
currentText = backendValues.horizontalAlignment.value;
}
onCurrentTextChanged: {
if (count == 3);
backendValues.horizontalAlignment.value = currentText;
}
}
ComboBox {
items : { ["AlignTop", "AlignBottom", "AlignVCenter"] }
currentText: backendValues.verticalAlignment.value;
onItemsChanged: {
currentText = backendValues.verticalAlignment.value;
}
onCurrentTextChanged: {
if (count == 3)
backendValues.verticalAlignment.value = currentText;
}
}
}
}
ColorWidget {
text: "Color:";
color: backendValues.color.value;
onColorChanged: {
backendValues.color.value = strColor;
}
}
ColorWidget {
visible: showStyleColor
text: "Style color:";
color: backendValues.styleColor.value;
onColorChanged: {
backendValues.styleColor.value = strColor;
}
}
}
}
import Qt 4.6
import Bauhaus 1.0
GroupBox {
maximumHeight: 600;
finished: finishedNotify;
caption: "Text Edit";
QWidget {
id: textSpecifics;
layout: QVBoxLayout {
id: textSpecifics;
topMargin: 20;
bottomMargin: 2;
leftMargin: 4;
rightMargin: 4;
QWidget {
layout: QHBoxLayout {
topMargin: 8;
bottomMargin: 2;
leftMargin: 10;
rightMargin: 0;
spacing: 20;
QLabel {
alignment: "AlignTop";
text: "Text:"
font.bold: true;
}
QTextEdit {
minimumHeight: 80;
property var localText: backendValues.text.value;
onLocalTextChanged: {
if (localText != plainText)
plainText = localText;