Commit b0d9dd0b authored by Nikolai Kosjar's avatar Nikolai Kosjar

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: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 0855d4ac
......@@ -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)
......
......@@ -128,6 +128,8 @@ public:
QSharedPointer<FunctionDeclDefLink> declDefLink() const;
void applyDeclDefLinkChanges(bool jumpToMatch);
void updateContentsChangedSignal();
Q_SIGNALS:
void outlineModelIndexChanged(const QModelIndex &index);
......
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