summaryrefslogtreecommitdiff
path: root/share/qtcreator/qmldesigner
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@nokia.com>2011-06-21 16:11:55 +0200
committerThomas Hartmann <Thomas.Hartmann@nokia.com>2011-06-21 16:12:36 +0200
commit723a20488b173fd51a3303e6701d9b6ef8266e54 (patch)
tree1cd602901af47d5fd508078cb181dd6ddc7d6dc9 /share/qtcreator/qmldesigner
parentcf98df93cd37b1c3dd6e809828fcabd7bc3b28b9 (diff)
downloadqt-creator-723a20488b173fd51a3303e6701d9b6ef8266e54.tar.gz
QmlDesigner.propertyEditor: adding translation support
Adding support for qsTr() Change-Id: Ib678820c40e910f744d9722e7958225dcc115d70 Reviewed-on: http://codereview.qt.nokia.com/565 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
Diffstat (limited to 'share/qtcreator/qmldesigner')
-rw-r--r--share/qtcreator/qmldesigner/propertyeditor/Qt/ExtendedFunctionButton.qml13
-rw-r--r--share/qtcreator/qmldesigner/propertyeditor/Qt/LineEdit.qml33
-rw-r--r--share/qtcreator/qmldesigner/propertyeditor/Qt/StandardTextGroupBox.qml1
3 files changed, 44 insertions, 3 deletions
diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/ExtendedFunctionButton.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/ExtendedFunctionButton.qml
index 3f2956c93a..b943e395d3 100644
--- a/share/qtcreator/qmldesigner/propertyeditor/Qt/ExtendedFunctionButton.qml
+++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/ExtendedFunctionButton.qml
@@ -11,8 +11,12 @@ AnimatedToolButton {
function setIcon() {
if (backendValue == null)
extendedFunctionButton.iconFromFile = "images/placeholder.png"
- else if (backendValue.isBound) {
- extendedFunctionButton.iconFromFile = "images/expression.png"
+ else if (backendValue.isBound ) {
+ if (backendValue.isTranslated) { //translations are a special case
+ extendedFunctionButton.iconFromFile = "images/placeholder.png"
+ } else {
+ extendedFunctionButton.iconFromFile = "images/expression.png"
+ }
} else {
if (backendValue.complexNode != null && backendValue.complexNode.exists) {
extendedFunctionButton.iconFromFile = "images/behaivour.png"
@@ -26,11 +30,16 @@ AnimatedToolButton {
setIcon();
}
property bool isBoundBackend: backendValue.isBound;
+ property string backendExpression: backendValue.expression;
onIsBoundBackendChanged: {
setIcon();
}
+ onBackendExpressionChanged: {
+ setIcon();
+ }
+
toolButtonStyle: "Qt::ToolButtonIconOnly"
popupMode: "QToolButton::InstantPopup";
property bool active: false;
diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/LineEdit.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/LineEdit.qml
index e1bb4c7238..0909caf846 100644
--- a/share/qtcreator/qmldesigner/propertyeditor/Qt/LineEdit.qml
+++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/LineEdit.qml
@@ -9,6 +9,7 @@ QWidget {
property variant baseStateFlag
property alias text: lineEditWidget.text
property alias readOnly: lineEditWidget.readOnly
+ property alias translation: trCheckbox.visible
minimumHeight: 24;
@@ -68,7 +69,11 @@ QWidget {
}
onEditingFinished: {
- backendValue.value = text
+ if (backendValue.isTranslated) {
+ backendValue.expression = "qsTr(\"" + text + "\")"
+ } else {
+ backendValue.value = text
+ }
evaluate();
}
@@ -87,4 +92,30 @@ QWidget {
x: 0
visible: lineEdit.enabled
}
+ QCheckBox {
+ id: trCheckbox
+ y: 2
+ styleSheetFile: "checkbox_tr.css";
+ toolTip: qsTr("Translate this string")
+ x: lineEditWidget.width - 22
+ height: lineEdit.height - 2;
+ width: 24
+ visible: false
+ checked: backendValue.isTranslated
+ onToggled: {
+ if (trCheckbox.checked) {
+ backendValue.expression = "qsTr(\"" + lineEditWidget.text + "\")"
+ } else {
+ backendValue.value = lineEditWidget.text
+ }
+ evaluate();
+ }
+
+ onVisibleChanged: {
+ if (trCheckbox.visible) {
+ trCheckbox.raise();
+ lineEditWidget.styleSheet = "QLineEdit { padding-left: 32; padding-right: 62;}"
+ }
+ }
+ }
}
diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/StandardTextGroupBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/StandardTextGroupBox.qml
index 1662a2419e..3f29936cbf 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;
+ translation: true
}
}
}