Commit 8a4fcad9 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigenr.PropertyEditor: fixing styling of binding editor

Change-Id: Ia0ee9345a5cc1a8b5a9f9208306d91edb47ace35
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 82a54c28
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.0 as Controls import QtQuick.Controls 1.0 as Controls
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import QtQuick.Controls.Styles 1.1
import "Constants.js" as Constants
Item { Item {
width: 14 width: 14
...@@ -72,13 +74,13 @@ Item { ...@@ -72,13 +74,13 @@ Item {
property string backendExpression: backendValue.expression; property string backendExpression: backendValue.expression;
onActiveChanged: { onActiveChanged: {
if (active) { if (active) {
setIcon(); setIcon();
opacity = 1; opacity = 1;
} else { } else {
opacity = 0; opacity = 0;
}
} }
}
onIsBoundBackendChanged: { onIsBoundBackendChanged: {
setIcon(); setIcon();
...@@ -107,76 +109,126 @@ Item { ...@@ -107,76 +109,126 @@ Item {
} }
} }
Controls.Menu { Controls.Menu {
id: menu id: menu
Controls.MenuItem { Controls.MenuItem {
text: "Reset" text: "Reset"
onTriggered: { onTriggered: {
transaction.start(); transaction.start();
backendValue.resetValue(); backendValue.resetValue();
backendValue.resetValue(); backendValue.resetValue();
transaction.end(); transaction.end();
} }
} }
Controls.MenuItem { Controls.MenuItem {
text: "Set Binding" text: "Set Binding"
onTriggered: { onTriggered: {
textField.text = backendValue.expression textField.text = backendValue.expression
expressionDialog.visible = true expressionDialog.visible = true
} }
} }
} }
Rectangle { Rectangle {
parent: itemPane parent: itemPane
visible: false visible: false
x: 10 x: 10
color: "gray" color: "#424242"
radius: 4
id: expressionDialog radius: 3
border.color: "black"
onVisibleChanged: { gradient: Gradient {
var pos = itemPane.mapFromItem(extendedFunctionButton.parent, 0, 0); GradientStop {color: "#2c2c2c" ; position: 0}
y = pos.y + 2; GradientStop {color: "#343434" ; position: 0.15}
} GradientStop {color: "#373737" ; position: 1.0}
}
width: parent.width - 20
height: 120 id: expressionDialog
Controls.TextField { onVisibleChanged: {
id: textField var pos = itemPane.mapFromItem(extendedFunctionButton.parent, 0, 0);
anchors.fill: parent y = pos.y + 2;
anchors.leftMargin: 4 }
anchors.rightMargin: 4
anchors.topMargin: 4 width: parent.width - 20
anchors.bottomMargin: 20 height: 120
onAccepted: {
backendValue.expression = textField.text Controls.TextField {
expressionDialog.visible = false id: textField
} anchors.fill: parent
} anchors.leftMargin: 4
anchors.rightMargin: 4
Row { anchors.topMargin: 4
spacing: 6 anchors.bottomMargin: 20
onAccepted: {
Controls.Button { backendValue.expression = textField.text
text: "Apply" expressionDialog.visible = false
iconSource: "images/apply.png" }
onClicked: {
backendValue.expression = textField.text style: TextFieldStyle {
expressionDialog.visible = false textColor: Constants.colorsDefaultText
} padding.top: 3
} padding.bottom: 1
Controls.Button { padding.left: 16
text: "Cancel" placeholderTextColor: "gray"
iconSource: "images/cancel.png" background: Rectangle {
onClicked: { implicitWidth: 100
expressionDialog.visible = false implicitHeight: 23
} radius: 3
} gradient: Gradient {
anchors.right: parent.right GradientStop {color: "#2c2c2c" ; position: 0}
anchors.bottom: parent.bottom GradientStop {color: "#343434" ; position: 0.15}
} GradientStop {color: "#373737" ; position: 1.0}
} }
}
}
}
Row {
spacing: 0
Button {
style: ButtonStyle {
background: Image {
source: "images/apply.png"
Rectangle {
opacity: control.pressed ? 0.5 : 0
anchors.fill: parent
gradient: Gradient {
GradientStop {color: "#606060" ; position: 0}
GradientStop {color: "#404040" ; position: 0.07}
GradientStop {color: "#303030" ; position: 1}
}
}
}
}
onClicked: {
backendValue.expression = textField.text
expressionDialog.visible = false
}
}
Button {
style: ButtonStyle {
background: Image {
source: "images/cancel.png"
Rectangle {
opacity: control.pressed ? 0.5 : 0
anchors.fill: parent
gradient: Gradient {
GradientStop {color: "#606060" ; position: 0}
GradientStop {color: "#404040" ; position: 0.07}
GradientStop {color: "#303030" ; position: 1}
}
}
}
}
onClicked: {
expressionDialog.visible = false
}
}
anchors.right: parent.right
anchors.bottom: parent.bottom
}
}
} }
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