QmlDesigner: Fix crash

This does not fix the bug altogether,
but if escaped quotes inside translatable strings are required,
then those can be done in the text editor.

The crash is turned into an error message.

Task-number: QTCREATORBUG-20684
Change-Id: I702628fbe888450a27c07166d5adacde37b5d1e1
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2018-07-03 09:18:37 +02:00
committed by Tim Jenssen
parent b9328012b1
commit 29e6659e90

View File

@@ -27,6 +27,7 @@
#include <formeditorscene.h>
#include <nodemetainfo.h>
#include <rewritingexception.h>
#include <QLineEdit>
#include <QTextEdit>
@@ -48,6 +49,7 @@ TextEditItem::~TextEditItem()
void TextEditItem::writeTextToProperty()
{
if (m_formEditorItem) {
try {
if (text().isEmpty())
m_formEditorItem->qmlItemNode().removeProperty("text");
else if (m_formEditorItem->qmlItemNode().isTranslatableText("text"))
@@ -55,6 +57,10 @@ void TextEditItem::writeTextToProperty()
else
m_formEditorItem->qmlItemNode().setVariantProperty("text", text());
}
catch (const RewritingException &e) {
e.showException();
}
}
}
void TextEditItem::setFormEditorItem(FormEditorItem *formEditorItem)