summaryrefslogtreecommitdiff
path: root/src/plugins/qmldesigner/components
diff options
context:
space:
mode:
authorTakumi ASAKI <asaki@sra.co.jp>2015-12-14 16:31:29 +0900
committerTakumi ASAKI <takumi.asaki@gmail.com>2015-12-15 00:34:57 +0000
commit44bb3cb4c31e9e4e5362f8779dcf1dfc335fad69 (patch)
tree4c37225beb0aabab0bcd3b4e6a7c963d176d393c /src/plugins/qmldesigner/components
parentb242c100cb0dc82b6fadb0fea960ccab8b9ca6c4 (diff)
downloadqt-creator-44bb3cb4c31e9e4e5362f8779dcf1dfc335fad69.tar.gz
QmlDesigner: Adding qsTrId() support
Task-number: QTBUG-48850 Change-Id: I16a0612ec29b552a3d46f2563fdc2a043b9dec7e Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmldesigner/components')
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp8
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h1
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp3
3 files changed, 10 insertions, 2 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp
index 1ef8716a37..30c856539a 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp
@@ -26,6 +26,7 @@
#include "propertyeditorcontextobject.h"
#include <QQmlContext>
+#include <qmldesignerplugin.h>
static uchar fromHex(const uchar c, const uchar c2)
{
@@ -102,6 +103,13 @@ QColor PropertyEditorContextObject::colorFromString(const QString &colorString)
return convertColorFromString(colorString);
}
+QString PropertyEditorContextObject::translateFunction()
+{
+ if (QmlDesignerPlugin::instance()->settings().useQsTrFunction)
+ return QStringLiteral("qsTr");
+ return QStringLiteral("qsTrId");
+}
+
int PropertyEditorContextObject::majorVersion() const
{
return m_majorVersion;
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h
index 3115a53c9d..0fb999fa56 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h
@@ -70,6 +70,7 @@ public:
Q_INVOKABLE QString convertColorToString(const QColor &color);
Q_INVOKABLE QColor colorFromString(const QString &colorString);
+ Q_INVOKABLE QString translateFunction();
int majorVersion() const;
int majorQtQuickVersion() const;
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
index f376012c12..4389f9d2c3 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
@@ -236,9 +236,8 @@ bool PropertyEditorValue::isTranslated() const
if (modelNode().metaInfo().propertyTypeName(name()) == "QString" || modelNode().metaInfo().propertyTypeName(name()) == "string") {
const QmlDesigner::QmlObjectNode objectNode(modelNode());
if (objectNode.isValid() && objectNode.hasBindingProperty(name())) {
- QRegExp rx("qsTr(\"*\")");
+ QRegExp rx("qsTr(|Id)\\(\".*\"\\)");
//qsTr()
- rx.setPatternSyntax(QRegExp::Wildcard);
if (objectNode.propertyAffectedByCurrentState(name())) {
return rx.exactMatch(expression());
} else {