forked from qt-creator/qt-creator
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:
committed by
Tim Jenssen
parent
b9328012b1
commit
29e6659e90
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include <formeditorscene.h>
|
#include <formeditorscene.h>
|
||||||
#include <nodemetainfo.h>
|
#include <nodemetainfo.h>
|
||||||
|
#include <rewritingexception.h>
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
@@ -48,6 +49,7 @@ TextEditItem::~TextEditItem()
|
|||||||
void TextEditItem::writeTextToProperty()
|
void TextEditItem::writeTextToProperty()
|
||||||
{
|
{
|
||||||
if (m_formEditorItem) {
|
if (m_formEditorItem) {
|
||||||
|
try {
|
||||||
if (text().isEmpty())
|
if (text().isEmpty())
|
||||||
m_formEditorItem->qmlItemNode().removeProperty("text");
|
m_formEditorItem->qmlItemNode().removeProperty("text");
|
||||||
else if (m_formEditorItem->qmlItemNode().isTranslatableText("text"))
|
else if (m_formEditorItem->qmlItemNode().isTranslatableText("text"))
|
||||||
@@ -55,6 +57,10 @@ void TextEditItem::writeTextToProperty()
|
|||||||
else
|
else
|
||||||
m_formEditorItem->qmlItemNode().setVariantProperty("text", text());
|
m_formEditorItem->qmlItemNode().setVariantProperty("text", text());
|
||||||
}
|
}
|
||||||
|
catch (const RewritingException &e) {
|
||||||
|
e.showException();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditItem::setFormEditorItem(FormEditorItem *formEditorItem)
|
void TextEditItem::setFormEditorItem(FormEditorItem *formEditorItem)
|
||||||
|
|||||||
Reference in New Issue
Block a user