void QmlJSLiveTextPreview::associateEditor(Core::IEditor *editor) { if (editor->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID) { QmlJSEditor::QmlJSTextEditorWidget* qmljsEditor = qobject_cast<QmlJSEditor::QmlJSTextEditorWidget*>(editor->widget()); if (qmljsEditor && !m_editors.contains(qmljsEditor)) { qmljsEditor->setUpdateSelectedElements(true); m_editors << qmljsEditor; connect(qmljsEditor, SIGNAL(selectedElementsChanged(QList<int>,QString)), SLOT(changeSelectedElements(QList<int>,QString))); } } }
void QmlJSLiveTextPreview::unassociateEditor(Core::IEditor *oldEditor) { if (oldEditor && oldEditor->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID) { QmlJSEditor::QmlJSTextEditorWidget* qmljsEditor = qobject_cast<QmlJSEditor::QmlJSTextEditorWidget*>(oldEditor->widget()); if (qmljsEditor && m_editors.contains(qmljsEditor)) { m_editors.removeOne(qmljsEditor); qmljsEditor->setUpdateSelectedElements(false); disconnect(qmljsEditor, SIGNAL(selectedElementsChanged(QList<int>,QString)), this, SLOT(changeSelectedElements(QList<int>,QString))); } } }