diff options
author | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2013-06-25 15:47:01 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2013-06-26 11:27:13 +0200 |
commit | b0d9dd0b47ea2733de7d895c326b3088264e5e39 (patch) | |
tree | 251843ebcda09cd3ef4a8e6cd7f4395c0a14508c /src/plugins/cppeditor | |
parent | 0855d4acfa65de088e7b780f6bb6a3c6b28cacba (diff) | |
download | qt-creator-b0d9dd0b47ea2733de7d895c326b3088264e5e39.tar.gz |
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>
Diffstat (limited to 'src/plugins/cppeditor')
-rw-r--r-- | src/plugins/cppeditor/cppeditor.cpp | 12 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppeditor.h | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 69cbe49437..a7ba65664d 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -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) diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h index 68f2c4ae0c..341d4fc872 100644 --- a/src/plugins/cppeditor/cppeditor.h +++ b/src/plugins/cppeditor/cppeditor.h @@ -128,6 +128,8 @@ public: QSharedPointer<FunctionDeclDefLink> declDefLink() const; void applyDeclDefLinkChanges(bool jumpToMatch); + void updateContentsChangedSignal(); + Q_SIGNALS: void outlineModelIndexChanged(const QModelIndex &index); |