forked from qt-creator/qt-creator
QmlDesigner.documentController: fix text design synchronisation
The synchronisation of selection between text and designmode was broken. This fixes a regression. Change-Id: I4d3fd2f9716398a16e01ce3d389d099bfad1f66b Reviewed-on: http://codereview.qt.nokia.com/401 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
@@ -536,9 +536,13 @@ void DesignModeWidget::setAutoSynchronization(bool sync)
|
||||
if (debug)
|
||||
qDebug() << Q_FUNC_INFO << sync;
|
||||
|
||||
RewriterView *rewriter = m_currentDesignDocumentController->rewriterView();
|
||||
|
||||
m_currentDesignDocumentController->blockModelSync(!sync);
|
||||
|
||||
if (sync) {
|
||||
if (rewriter && m_currentDesignDocumentController->model())
|
||||
rewriter->setSelectedModelNodes(QList<ModelNode>());
|
||||
// text editor -> visual editor
|
||||
if (!m_currentDesignDocumentController->model()) {
|
||||
m_currentDesignDocumentController->loadMaster(m_currentTextEdit.data());
|
||||
@@ -549,10 +553,9 @@ void DesignModeWidget::setAutoSynchronization(bool sync)
|
||||
QList<RewriterView::Error> errors = m_currentDesignDocumentController->qmlErrors();
|
||||
if (errors.isEmpty()) {
|
||||
// set selection to text cursor
|
||||
RewriterView *rewriter = m_currentDesignDocumentController->rewriterView();
|
||||
const int cursorPos = m_currentTextEdit->textCursor().position();
|
||||
ModelNode node = nodeForPosition(cursorPos);
|
||||
if (node.isValid()) {
|
||||
if (rewriter && node.isValid()) {
|
||||
rewriter->setSelectedModelNodes(QList<ModelNode>() << node);
|
||||
}
|
||||
enable();
|
||||
|
||||
Reference in New Issue
Block a user