Commit 6a75f054 authored by hjk's avatar hjk Committed by Christian Stenger

CppEditor: Move toolbar creation to Widget constructor

It doesn't need the editor parameter anymore, so the two-phase
setup can go. Note that both paths through ctor() finally hit
*Widget::createEditor() (one directly, one indirectly through
the first BaseTextEditorWidget::editor() call), so this doesn't
change what's set up, only when.

Change-Id: I65d9e317d796c8a5fe755d3d674cf79801e60617
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent c44f09ca
......@@ -222,33 +222,8 @@ void CppEditorWidget::ctor()
this, SLOT(onLocalRenamingFinished()));
connect(&d->m_localRenaming, SIGNAL(processKeyPressNormally(QKeyEvent*)),
this, SLOT(onLocalRenamingProcessKeyPressNormally(QKeyEvent*)));
}
CppEditorWidget::~CppEditorWidget()
{
if (d->m_modelManager)
d->m_modelManager->deleteCppEditorSupport(editor());
}
CPPEditorDocument *CppEditorWidget::cppEditorDocument() const
{
return d->m_cppEditorDocument;
}
CppEditorOutline *CppEditorWidget::outline() const
{
return d->m_cppEditorOutline;
}
TextEditor::BaseTextEditor *CppEditorWidget::createEditor()
{
CPPEditor *editable = new CPPEditor(this);
createToolBar(editable);
return editable;
}
void CppEditorWidget::createToolBar(CPPEditor *editor)
{
// Tool bar creation
d->m_updateUsesTimer = newSingleShotTimer(this, UPDATE_USES_INTERVAL);
connect(d->m_updateUsesTimer, SIGNAL(timeout()), this, SLOT(updateUsesNow()));
......@@ -281,6 +256,27 @@ void CppEditorWidget::createToolBar(CPPEditor *editor)
insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Left, d->m_cppEditorOutline->widget());
}
CppEditorWidget::~CppEditorWidget()
{
if (d->m_modelManager)
d->m_modelManager->deleteCppEditorSupport(editor());
}
CPPEditorDocument *CppEditorWidget::cppEditorDocument() const
{
return d->m_cppEditorDocument;
}
CppEditorOutline *CppEditorWidget::outline() const
{
return d->m_cppEditorOutline;
}
TextEditor::BaseTextEditor *CppEditorWidget::createEditor()
{
return new CPPEditor(this);
}
void CppEditorWidget::paste()
{
if (d->m_localRenaming.handlePaste())
......
......@@ -157,8 +157,6 @@ private:
CppEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
void ctor();
void createToolBar(CPPEditor *editable);
unsigned editorRevision() const;
bool isOutdated() const;
......
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