diff options
Diffstat (limited to 'src/plugins')
-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); |