Commit bfc68f15 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

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: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent 2941045a
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment