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()));
|
this, SLOT(onLocalRenamingFinished()));
|
||||||
connect(&d->m_localRenaming, SIGNAL(processKeyPressNormally(QKeyEvent*)),
|
connect(&d->m_localRenaming, SIGNAL(processKeyPressNormally(QKeyEvent*)),
|
||||||
this, SLOT(onLocalRenamingProcessKeyPressNormally(QKeyEvent*)));
|
this, SLOT(onLocalRenamingProcessKeyPressNormally(QKeyEvent*)));
|
||||||
}
|
|
||||||
|
|
||||||
CppEditorWidget::~CppEditorWidget()
|
// Tool bar creation
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
d->m_updateUsesTimer = newSingleShotTimer(this, UPDATE_USES_INTERVAL);
|
d->m_updateUsesTimer = newSingleShotTimer(this, UPDATE_USES_INTERVAL);
|
||||||
connect(d->m_updateUsesTimer, SIGNAL(timeout()), this, SLOT(updateUsesNow()));
|
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());
|
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()
|
void CppEditorWidget::paste()
|
||||||
{
|
{
|
||||||
if (d->m_localRenaming.handlePaste())
|
if (d->m_localRenaming.handlePaste())
|
||||||
|
|||||||
@@ -157,8 +157,6 @@ private:
|
|||||||
CppEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
|
CppEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
|
||||||
void ctor();
|
void ctor();
|
||||||
|
|
||||||
void createToolBar(CPPEditor *editable);
|
|
||||||
|
|
||||||
unsigned editorRevision() const;
|
unsigned editorRevision() const;
|
||||||
bool isOutdated() const;
|
bool isOutdated() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user