Qml Live Preview: lazily create QmlJSLiveTextPreview

This commit is contained in:
Olivier Goffart
2010-07-20 12:50:14 +02:00
parent 7bef076411
commit 95346f79e6
5 changed files with 9 additions and 16 deletions

View File

@@ -231,19 +231,9 @@ void Inspector::initializeDocuments()
connect(em, SIGNAL(editorOpened(Core::IEditor*)), SLOT(createPreviewForEditor(Core::IEditor*)));
// initial update
#if 0
foreach (Core::IEditor *editor, em->openedEditors()) {
createPreviewForEditor(editor);
}
#else
foreach (QmlJS::Document::Ptr doc, m_loadedSnapshot) {
QmlJSLiveTextPreview *preview = new QmlJSLiveTextPreview(doc, doc, this);
connect(preview,
SIGNAL(selectedItemsChanged(QList<QDeclarativeDebugObjectReference>)),
SLOT(changeSelectedItems(QList<QDeclarativeDebugObjectReference>)));
m_textPreviews.insert(doc->fileName(), preview);
}
#endif
}
void Inspector::serverReloaded()
@@ -286,6 +276,7 @@ void Inspector::createPreviewForEditor(Core::IEditor *newEditor)
SIGNAL(selectedItemsChanged(QList<QDeclarativeDebugObjectReference>)),
SLOT(changeSelectedItems(QList<QDeclarativeDebugObjectReference>)));
m_textPreviews.insert(newEditor->file()->fileName(), preview);
preview->updateDebugIds(m_clientProxy->rootObjectReference());
}
}
}