forked from qt-creator/qt-creator
QmlDesigner: Fix crash for in document handling
Detach rewriter for document switching. Change-Id: I4cc710990d01b30da25609961b81b07e785a26eb Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -284,7 +284,7 @@ void DesignDocument::resetToDocumentModel()
|
||||
m_rewriterView->setTextModifier(m_documentTextModifier.data());
|
||||
}
|
||||
|
||||
QList<RewriterView::Error> DesignDocument::loadDocument(QPlainTextEdit *edit)
|
||||
void DesignDocument::loadDocument(QPlainTextEdit *edit)
|
||||
{
|
||||
Q_CHECK_PTR(edit);
|
||||
|
||||
@@ -305,9 +305,7 @@ QList<RewriterView::Error> DesignDocument::loadDocument(QPlainTextEdit *edit)
|
||||
|
||||
m_subComponentManager->update(QUrl::fromLocalFile(fileName()), m_currentModel->imports());
|
||||
|
||||
activateCurrentModel(m_documentTextModifier.data());
|
||||
|
||||
return rewriterView()->errors();
|
||||
m_documentLoaded = true;
|
||||
}
|
||||
|
||||
void DesignDocument::changeCurrentModelTo(const ModelNode &node)
|
||||
@@ -391,37 +389,14 @@ void DesignDocument::activateCurrentModel(TextModifier *textModifier)
|
||||
// !differentCrumbleBarOnTop(m_formEditorView.data(), createCrumbleBarInfo().value<CrumbleBarInfo>()))
|
||||
// m_formEditorView->crumblePath()->pushElement(simplfiedDisplayName(), createCrumbleBarInfo());
|
||||
|
||||
m_documentLoaded = true;
|
||||
|
||||
Q_ASSERT(m_documentModel);
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void DesignDocument::activateCurrentModel()
|
||||
{
|
||||
if (currentModel() == documentModel())
|
||||
activateCurrentModel(m_documentTextModifier.data());
|
||||
else
|
||||
activateCurrentModel(m_inFileComponentTextModifier.data());
|
||||
}
|
||||
|
||||
void DesignDocument::activateDocumentModel()
|
||||
{
|
||||
//this function seems to be unused!
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
|
||||
Q_ASSERT(m_documentModel);
|
||||
Q_ASSERT(m_currentModel);
|
||||
|
||||
if (!plainTextEdit()->parent()) // hack to prevent changing owner of external text edit
|
||||
m_stackedWidget->addWidget(plainTextEdit());
|
||||
|
||||
m_currentModel = m_documentModel;
|
||||
m_documentLoaded = true;
|
||||
|
||||
updateSubcomponentManager();
|
||||
|
||||
Q_ASSERT(m_documentModel);
|
||||
QApplication::restoreOverrideCursor();
|
||||
activateCurrentModel(m_documentTextModifier.data());
|
||||
}
|
||||
|
||||
bool DesignDocument::isUndoAvailable() const
|
||||
|
||||
Reference in New Issue
Block a user