forked from qt-creator/qt-creator
CppEditor: Fix "Rename Symbol Under Cursor" in new split
The slot CPPEditorWidget::onContentsChanged() was still connected to the initial QTextDocument of BaseTextEditorWidgetPrivate and not to the via BaseTextEditorWidget::duplicateFrom() updated QTextDocument. This fixes the visual appearance when renaming. The actual renaming is/was not affected. Task-number: QTCREATORBUG-9651 Change-Id: Id26dc11627c253bbf89904be3f3df21a45041d01 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -641,9 +641,9 @@ void CPPEditorWidget::createToolBar(CPPEditor *editor)
|
||||
connect(m_outlineCombo, SIGNAL(activated(int)), this, SLOT(jumpToOutlineElement(int)));
|
||||
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateOutlineIndex()));
|
||||
connect(m_outlineCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateOutlineToolTip()));
|
||||
connect(document(), SIGNAL(contentsChange(int,int,int)),
|
||||
this, SLOT(onContentsChanged(int,int,int)));
|
||||
|
||||
// set up slots to document changes
|
||||
updateContentsChangedSignal();
|
||||
connect(editorDocument(), SIGNAL(changed()), this, SLOT(updateFileName()));
|
||||
|
||||
// set up function declaration - definition link
|
||||
@@ -1870,6 +1870,8 @@ Core::IEditor *CPPEditor::duplicate(QWidget *parent)
|
||||
{
|
||||
CPPEditorWidget *newEditor = new CPPEditorWidget(parent);
|
||||
newEditor->duplicateFrom(editorWidget());
|
||||
// A new QTextDocument was set, so update our signal/slot connection to the new document
|
||||
newEditor->updateContentsChangedSignal();
|
||||
CppEditorPlugin::instance()->initializeEditor(newEditor);
|
||||
return newEditor->editor();
|
||||
}
|
||||
@@ -2218,6 +2220,12 @@ void CPPEditorWidget::applyDeclDefLinkChanges(bool jumpToMatch)
|
||||
updateFunctionDeclDefLink();
|
||||
}
|
||||
|
||||
void CPPEditorWidget::updateContentsChangedSignal()
|
||||
{
|
||||
connect(document(), SIGNAL(contentsChange(int,int,int)),
|
||||
this, SLOT(onContentsChanged(int,int,int)));
|
||||
}
|
||||
|
||||
void CPPEditorWidget::abortDeclDefLink()
|
||||
{
|
||||
if (!m_declDefLink)
|
||||
|
||||
Reference in New Issue
Block a user