forked from qt-creator/qt-creator
DesignMode: Apply 'static pattern'
Also: - and replace some occurrences of DesignMode::instance()->id() by Core::Constants::MODE_DESIGN for less dependence on the lifetime of the DesignMode object (and less indirection) - remove storage if DesignMode::instance() values when direct use of the static functions suffice - remove some unused items from the interface - use member-initialization in DesignMode::Private. Change-Id: Ie66c06da0fc0a3ccc588b8079e51db6b39284152 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -118,7 +118,7 @@ ScxmlEditorData::~ScxmlEditorData()
|
||||
ICore::removeContextObject(m_context);
|
||||
|
||||
if (m_modeWidget) {
|
||||
m_designMode->unregisterDesignWidget(m_modeWidget);
|
||||
DesignMode::unregisterDesignWidget(m_modeWidget);
|
||||
delete m_modeWidget;
|
||||
m_modeWidget = nullptr;
|
||||
}
|
||||
@@ -132,7 +132,6 @@ void ScxmlEditorData::fullInit()
|
||||
m_widgetStack = new ScxmlEditorStack;
|
||||
m_widgetToolBar = new QToolBar;
|
||||
m_mainToolBar = createMainToolBar();
|
||||
m_designMode = DesignMode::instance();
|
||||
m_modeWidget = createModeWidget();
|
||||
|
||||
// Create undo/redo group/actions
|
||||
@@ -153,7 +152,7 @@ void ScxmlEditorData::fullInit()
|
||||
m_context = new ScxmlContext(scxmlContexts, m_modeWidget, this);
|
||||
ICore::addContextObject(m_context);
|
||||
|
||||
m_designMode->registerDesignWidget(m_modeWidget, QStringList(QLatin1String(ProjectExplorer::Constants::SCXML_MIMETYPE)), m_contexts);
|
||||
DesignMode::registerDesignWidget(m_modeWidget, QStringList(QLatin1String(ProjectExplorer::Constants::SCXML_MIMETYPE)), m_contexts);
|
||||
}
|
||||
|
||||
IEditor *ScxmlEditorData::createEditor()
|
||||
@@ -232,7 +231,7 @@ QWidget *ScxmlEditorData::createModeWidget()
|
||||
// 'Run' in 'Design' mode emits output.
|
||||
auto splitter = new MiniSplitter(Qt::Vertical);
|
||||
splitter->addWidget(m_widgetStack);
|
||||
auto outputPane = new OutputPanePlaceHolder(m_designMode->id(), splitter);
|
||||
auto outputPane = new OutputPanePlaceHolder(Core::Constants::MODE_DESIGN, splitter);
|
||||
outputPane->setObjectName("DesignerOutputPanePlaceHolder");
|
||||
splitter->addWidget(outputPane);
|
||||
layout->addWidget(splitter);
|
||||
|
||||
Reference in New Issue
Block a user