Esempio n. 1
0
/*!
  Switches whether the model (and therefore the views) are updated if the text editor
  changes.

  If the synchronization is enabled again, the model is automatically resynchronized
  with the current state of the text editor.
  */
void DesignDocumentController::blockModelSync(bool block)
{
    if (d->syncBlocked == block)
        return;

    d->syncBlocked = block;

    if (d->textModifier) {
        if (d->syncBlocked) {
            detachNodeInstanceView();
            d->textModifier->deactivateChangeSignals();
        } else {
            activeQtVersionChanged();
            changeToMasterModel();
            QmlModelState state;
            //We go back to base state (and back again) to avoid side effects from text editing.
            if (d->statesEditorView && d->statesEditorView->model()) {
                state = d->statesEditorView->currentState();
                d->statesEditorView->setCurrentState(d->statesEditorView->baseState());

            }

            d->textModifier->reactivateChangeSignals();

            if (state.isValid() && d->statesEditorView)
                d->statesEditorView->setCurrentState(state);
            attachNodeInstanceView();
            if (d->propertyEditorView)
                d->propertyEditorView->resetView();
            if (d->formEditorView)
                d->formEditorView->resetView();
        }
    }
}
Esempio n. 2
0
void ViewManager::attachViewsExceptRewriterAndComponetView()
{
    if (QmlDesignerPlugin::instance()->settings().enableDebugView)
        currentModel()->attachView(&m_debugView);
    attachNodeInstanceView();
    currentModel()->attachView(&m_formEditorView);
    currentModel()->attachView(&m_navigatorView);
    attachItemLibraryView();
    currentModel()->attachView(&m_statesEditorView);
    currentModel()->attachView(&m_propertyEditorView);
    currentModel()->attachView(DesignerActionManager::view());
    attachAdditionalViews();
    switchStateEditorViewToSavedState();
}