forked from qt-creator/qt-creator
QmlDesigner: Polish error handling for integrated text editor
The integrated text editor requires a couple of fixes and features in the error handling. The errors are now handled by the model and not the document management anymore. The text editor does not get disabled if there is an error. Instead we show the error in a status bar. The form editor is blocked if there is a QML an error and we show the error message inside the form editor. Change-Id: I4bfb9b33b09e444ec1de31dd531ce83b32cbcf88 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
8b67458a95
commit
759db2b7b6
@@ -51,7 +51,6 @@ TextEditorView::TextEditorView(QObject *parent)
|
||||
: AbstractView(parent)
|
||||
, m_widget(new TextEditorWidget(this))
|
||||
{
|
||||
// not completely sure that we need this to just call the right help method ->
|
||||
Internal::TextEditorContext *textEditorContext = new Internal::TextEditorContext(m_widget.get());
|
||||
Core::ICore::addContextObject(textEditorContext);
|
||||
}
|
||||
@@ -96,7 +95,7 @@ void TextEditorView::nodeReparented(const ModelNode &/*node*/, const NodeAbstrac
|
||||
|
||||
WidgetInfo TextEditorView::widgetInfo()
|
||||
{
|
||||
return createWidgetInfo(m_widget.get(), 0, "TextEditor", WidgetInfo::CentralPane, 0, tr("Text Editor"));
|
||||
return createWidgetInfo(m_widget.get(), 0, "TextEditor", WidgetInfo::CentralPane, 0, tr("Text Editor"), DesignerWidgetFlags::IgnoreErrors);
|
||||
}
|
||||
|
||||
QString TextEditorView::contextHelpId() const
|
||||
@@ -123,6 +122,16 @@ void TextEditorView::customNotification(const AbstractView * /*view*/, const QSt
|
||||
{
|
||||
}
|
||||
|
||||
void TextEditorView::documentMessagesChanged(const QList<RewriterError> &errors, const QList<RewriterError> &)
|
||||
{
|
||||
if (errors.isEmpty()) {
|
||||
m_widget->clearStatusBar();
|
||||
} else {
|
||||
const RewriterError error = errors.first();
|
||||
m_widget->setStatusText(QString("%1 (Line: %2)").arg(error.description()).arg(error.line()));
|
||||
}
|
||||
}
|
||||
|
||||
bool TextEditorView::changeToMoveTool()
|
||||
{
|
||||
return true;
|
||||
@@ -181,6 +190,12 @@ void TextEditorView::rewriterEndTransaction()
|
||||
{
|
||||
}
|
||||
|
||||
void TextEditorView::gotoCursorPosition(int line, int column)
|
||||
{
|
||||
if (m_widget)
|
||||
m_widget->gotoCursorPosition(line, column);
|
||||
}
|
||||
|
||||
void TextEditorView::instancePropertyChanged(const QList<QPair<ModelNode, PropertyName> > &/*propertyList*/)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user