Commit f905c990 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.propertyEditor: update of the property editor

parent 69f6742d
......@@ -6,17 +6,17 @@ QWidget {
styleSheetFile: "anchorbox.css"
Script {
function isBorderAnchored() {
return anchorBackend.leftAnchored || anchorBackend.topAnchored || anchorBackend.rightAnchored || anchorBackend.bottomAnchored;
}
function isBorderAnchored() {
return anchorBackend.leftAnchored || anchorBackend.topAnchored || anchorBackend.rightAnchored || anchorBackend.bottomAnchored;
}
function fill() {
function fill() {
anchorBackend.fill();
}
}
function breakLayout() {
function breakLayout() {
anchorBackend.resetLayout()
}
}
}
QPushButton {
......@@ -30,7 +30,7 @@ QWidget {
}
QPushButton {
text: "break";
text: "break";
y: 200;
height:20;fixedHeight: height;
width:200;fixedWidth: width;
......@@ -51,12 +51,12 @@ QWidget {
checkable: true;
checked: anchorBackend.leftAnchored;
onReleased: {
if (checked) {
if (checked) {
anchorBackend.horizontalCentered = false;
anchorBackend.leftAnchored = true;
} else {
} else {
anchorBackend.leftAnchored = false;
}
}
}
}
......@@ -72,12 +72,12 @@ QWidget {
checkable: true;
checked: anchorBackend.topAnchored;
onReleased: {
if (checked) {
if (checked) {
anchorBackend.verticalCentered = false;
anchorBackend.topAnchored = true;
} else {
} else {
anchorBackend.topAnchored = false;
}
}
}
}
......@@ -93,12 +93,12 @@ QWidget {
checkable: true;
checked: anchorBackend.rightAnchored;
onReleased: {
if (checked) {
if (checked) {
anchorBackend.horizontalCentered = false;
anchorBackend.rightAnchored = true;
} else {
} else {
anchorBackend.rightAnchored = false;
}
}
}
}
......@@ -114,12 +114,12 @@ QWidget {
checkable: true;
checked: anchorBackend.bottomAnchored;
onReleased: {
if (checked) {
if (checked) {
anchorBackend.verticalCentered = false;
anchorBackend.bottomAnchored = true;
} else {
} else {
anchorBackend.bottomAnchored = false;
}
}
}
}
......@@ -142,11 +142,11 @@ QWidget {
checked: anchorBackend.horizontalCentered;
onReleased: {
if (checked) {
anchorBackend.rightAnchored = false;
anchorBackend.leftAnchored = false;
anchorBackend.horizontalCentered = true;
anchorBackend.rightAnchored = false;
anchorBackend.leftAnchored = false;
anchorBackend.horizontalCentered = true;
} else {
anchorBackend.horizontalCentered = false;
anchorBackend.horizontalCentered = false;
}
}
}
......@@ -161,11 +161,11 @@ QWidget {
checked: anchorBackend.verticalCentered;
onReleased: {
if (checked) {
anchorBackend.topAnchored = false;
anchorBackend.bottomAnchored = false;
anchorBackend.verticalCentered = true;
anchorBackend.topAnchored = false;
anchorBackend.bottomAnchored = false;
anchorBackend.verticalCentered = true;
} else {
anchorBackend.verticalCentered = false;
anchorBackend.verticalCentered = false;
}
}
}
......
......@@ -9,143 +9,86 @@ 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 text: label.text
property var enabled
minimumHeight: 22;
onBaseStateFlagChanged: {
evaluate();
setIcon();
}
onBackendValueChanged: {
evaluate();
setIcon();
}
Script {
Script {
function evaluate() {
if (baseStateFlag) {
if (backendValue != null && backendValue.isInModel)
DoubleSpinBox.setStyleSheet("color: white;");
box.setStyleSheet("color: white;");
else
DoubleSpinBox.setStyleSheet("color: gray;");
box.setStyleSheet("color: gray;");
} else {
if (backendValue != null && backendValue.isInSubState)
DoubleSpinBox.setStyleSheet("color: #7799FF;");
else
DoubleSpinBox.setStyleSheet("color: gray;");
if (backendValue != null && backendValue.isInSubState)
box.setStyleSheet("color: #7799FF;");
else
box.setStyleSheet("color: gray;");
}
}
}
layout: QHBoxLayout {
topMargin: 0;
bottomMargin: 0;
leftMargin: 0;
rightMargin: 2;
spacing: 0;
property bool isInModel: backendValue.isInModel
onIsInModelChanged: {
evaluate();
}
property bool isInSubState: backendValue.isInSubState
onIsInSubStateChanged: {
evaluate();
}
layout: HorizontalLayout {
QLabel {
visible: text != ""
id: label;
alignment: "Qt::AlignRight | Qt::AlignVCenter"
}
QDoubleSpinBox {
id: box;
decimals: 2;
decimals: 1;
keyboardTracking: false;
enabled: (backendValue == null || backendValue.complexNode == null) ? false : !backendValue.isBound && !backendValue.complexNode.exists
enabled: !backendValue.isBound && DoubleSpinBox.enabled;
property bool readingFromBackend: false;
property real valueFromBackend: DoubleSpinBox.backendValue == null ? .0 : DoubleSpinBox.backendValue.value;
onValueFromBackendChanged: {
readingFromBackend = true;
value = valueFromBackend
readingFromBackend = false;
}
}
onValueChanged: {
if (DoubleSpinBox.backendValue != null && readingFromBackend == false)
onValueChanged: {
if (DoubleSpinBox.backendValue != null && readingFromBackend == false)
DoubleSpinBox.backendValue.value = value;
}
onFocusChanged: {
//extendedSwitches.active = focus;
//extendedSwitches.backendValue = backendValue;
}
onMouseOverChanged: {
//extendedButton.active = mouseOver;
}
}
}
QToolButton {
property bool active: false;
id: extendedButton;
iconFromFile: "images/expression.png";
visible: false;
width: 14;
height: 14;
y: box.y + 2;
x: box.x + 2;
focusPolicy: "Qt::NoFocus";
opacity: 0;
opacity: Behavior {
NumberAnimation {
easing: "easeInSine"
duration: 200
}
}
onPressed: {
}
onMouseOverChanged: {
Script {
function setIcon() {
if (backendValue == null)
extendedButton.iconFromFile = "images/placeholder.png"
else if (backendValue.isBound) {
extendedButton.iconFromFile = "images/expression.png"
} else {
if (backendValue.complexNode != null && backendValue.complexNode.exists) {
extendedButton.iconFromFile = "images/behaivour.png"
} else {
extendedButton.iconFromFile = "images/placeholder.png"
}
}
}
}
onMouseOverChanged: {
if (mouseOver) {
iconFromFile = "images/submenu.png";
opacity = 1;
} else {
setIcon();
opacity = 0;
}
}
onActiveChanged: {
if (active) {
setIcon();
opacity = 1;
} else {
opacity = 0;
}
}
}
menu: QMenu {
actions: [
QAction {
text: "Reset";
},
QAction {
text: "Set Expression";
},
QAction {
text: "Add Behaivour";
}
]
}
toolButtonStyle: "Qt::ToolButtonIconOnly";
popupMode: "QToolButton::InstantPopup";
arrowType: "Qt::NoArrow";
ExtendedFunctionButton {
backendValue: DoubleSpinBox.backendValue
y: box.y + 4
x: box.x + 2
visible: DoubleSpinBox.enabled
}
}
import Qt 4.6
import Bauhaus 1.0
QWidget {
id: ExpressionEditor;
x: 6
y: -400
width: frame.width - 22
height: 40
property bool active: false
property var backendValue;
onActiveChanged: {
//text = "";
if (active) {
textEdit.plainText = backendValue.expression
textEdit.setFocus();
opacity = 1;
height = 100
} else {
opacity = 0;
height = 40;
}
}
opacity: 0
onOpacityChanged: {
if (opacity == 0)
lower();
}
opacity: Behavior {
NumberAnimation {
duration: 100
}
}
height: Behavior {
NumberAnimation {
duration: 100
}
}
QTextEdit {
id: textEdit;
styleSheet: "QTextEdit {border-radius: 0px;}"
acceptRichText: false;
documentTitle: "Expression"
width: expressionEdit.width
height: expressionEdit.height
horizontalScrollBarPolicy: "Qt::ScrollBarAlwaysOff"
verticalScrollBarPolicy: "Qt::ScrollBarAlwaysOff"
onFocusChanged: {
if (!focus)
expressionEdit.active = false;
}
}
QPushButton {
y: expressionEdit.height - 22;
x: expressionEdit.width - 61;
styleSheetFile: "applybutton.css";
width: 29
height: 19
onClicked: {
expressionEdit.backendValue.expression = textEdit.plainText;
expressionEdit.active = false;
}
}
QPushButton {
y: expressionEdit.height - 22;
x: expressionEdit.width - 32;
styleSheetFile: "cancelbutton.css";
width: 29
height: 19
onClicked: {
expressionEdit.active = false;
}
}
}
......@@ -2,24 +2,22 @@ import Qt 4.6
import Bauhaus 1.0
GroupBox {
caption: "Effects"
caption: "Effect"
id: Extended;
maximumHeight: 260;
layout: QVBoxLayout {
topMargin: 12;
leftMargin: 10;
rightMargin: 10;
layout: VerticalLayout{
property var effect: backendValues.effect
property var complexNode: effect.complexNode
QWidget {
maximumHeight: 40;
layout: QHBoxLayout {
layout: HorizontalLayout {
QLabel {
text: "Effects: ";
text: "Effect ";
font.bold: true;
alignment: "Qt::AlignRight | Qt::AlignVCenter"
}
QComboBox {
enabled: isBaseState;
......@@ -63,6 +61,10 @@ layout: QVBoxLayout {
dirty = false;
}
}
QWidget {
fixedWidth: 100
}
}
}// QWidget
......
import Qt 4.6
import Bauhaus 1.0
QToolButton {
id: ExtendedFunctionButton
property var backendValue
Script {
function setIcon() {
if (backendValue == null)
ExtendedFunctionButton.iconFromFile = "images/placeholder.png"
else if (backendValue.isBound) {
ExtendedFunctionButton.iconFromFile = "images/expression.png"
} else {
if (backendValue.complexNode != null && backendValue.complexNode.exists) {
ExtendedFunctionButton.iconFromFile = "images/behaivour.png"
} else {
ExtendedFunctionButton.iconFromFile = "images/placeholder.png"
}
}
}
}
onBackendValueChanged: {
setIcon();
}
property bool isBoundBackend: backendValue.isBound;
onIsBoundBackendChanged: {
setIcon();
}
toolButtonStyle: "Qt::ToolButtonIconOnly"
popupMode: "QToolButton::InstantPopup";
property bool active: false;
iconFromFile: "images/placeholder.png";
width: 14;
height: 14;
focusPolicy: "Qt::NoFocus";
styleSheet: "*::down-arrow, *::menu-indicator { image: none; width: 0; height: 0; }";
onMouseOverChanged: {
if (mouseOver) {
iconFromFile = "images/submenu.png";
} else {
setIcon();
}
}
onActiveChanged: {
if (active) {
setIcon();
opacity = 1;
} else {
opacity = 0;
}
}
actions: [
QAction {
text: "Reset";
onTriggered: {
backendValue.resetValue();
}
},
QAction {
text: "Set Expression";
onTriggered: {
expressionEdit.globalY = box.globalY;
expressionEdit.backendValue = ExtendedFunctionButton.backendValue
expressionEdit.show();
expressionEdit.raise();
expressionEdit.active = true;
}
},
QAction {
text: "Add Behaivour";
}
]
}
......@@ -13,11 +13,12 @@ QScrollArea {
minimumHeight: 440;
id: ProperyEditorExtended
layout: QVBoxLayout {
topMargin: 2;
bottomMargin: 2;
leftMargin: 2;
rightMargin: 2;
Type {
topMargin: 0;
bottomMargin: 0;
leftMargin: 0;
rightMargin: 0;
spacing: 0;
Modifiers {
}
Extended {
id: extendedBox;
......
......@@ -7,160 +7,76 @@ GroupBox {
maximumHeight: 240;
layout: QHBoxLayout {
topMargin: 14;
bottomMargin: 4;
leftMargin: 4;
rightMargin: 4;
layout: VerticalLayout {
QWidget {
layout: QVBoxLayout {
topMargin: 0;
bottomMargin: 60;
leftMargin: 10;
rightMargin: 10;
spacing: 25;
QWidget { // 1
layout: HorizontalLayout {
QLabel {
text: "Position:";
font.bold: true;
text: "Position"
alignment: "Qt::AlignRight | Qt::AlignVCenter"
}
QLabel {
text: "Size:"
font.bold: true
DoubleSpinBox {
id: XSpinBox;
text: "X"
singleStep: 1;
objectName: "XSpinBox";
enabled: anchorBackend.hasParent;
backendValue: backendValues.x
minimum: -2000;
maximum: 2000;