forked from qt-creator/qt-creator
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: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user