summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2014-01-10 15:32:03 +0100
committerEike Ziller <eike.ziller@digia.com>2014-01-14 09:03:58 +0100
commitcfad9bdc3cb9fba3a565eaf9ac4f62dcf880c661 (patch)
treee5ce3e489494c05eb670aec33723079954e4f628 /src
parentad4b589231caa023fdb9f4a8e1ba42fbf593d06f (diff)
downloadqt-creator-cfad9bdc3cb9fba3a565eaf9ac4f62dcf880c661.tar.gz
TextEditors: Move contentsChanged signal from editor to document
Change-Id: Ic935a8971705cb3238deda71aa2b5d19e4f62593 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/cppeditor/cppeditor.cpp8
-rw-r--r--src/plugins/cpptools/cpptoolseditorsupport.cpp2
-rw-r--r--src/plugins/cpptools/cpptoolseditorsupport.h2
-rw-r--r--src/plugins/qmljseditor/qmljseditorplugin.cpp8
-rw-r--r--src/plugins/texteditor/basetextdocument.cpp1
-rw-r--r--src/plugins/texteditor/basetexteditor.cpp2
-rw-r--r--src/plugins/texteditor/basetexteditor.h3
-rw-r--r--src/plugins/texteditor/itexteditor.h4
8 files changed, 13 insertions, 17 deletions
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index f7c2ab987e..a933f866f6 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -1855,8 +1855,8 @@ void CPPEditorWidget::onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefL
Core::IDocument *targetDocument = Core::EditorManager::documentModel()->documentForFilePath(
m_declDefLink->targetFile->fileName());
if (baseTextDocument() != targetDocument) {
- if (TextEditor::BaseTextDocument *baseTextDocument = qobject_cast<TextEditor::BaseTextDocument *>(targetDocument))
- connect(baseTextDocument->document(), SIGNAL(contentsChanged()),
+ if (TextEditor::ITextEditorDocument *textEditorDocument = qobject_cast<TextEditor::ITextEditorDocument *>(targetDocument))
+ connect(textEditorDocument, SIGNAL(contentsChanged()),
this, SLOT(abortDeclDefLink()));
}
@@ -1884,8 +1884,8 @@ void CPPEditorWidget::abortDeclDefLink()
Core::IDocument *targetDocument = Core::EditorManager::documentModel()->documentForFilePath(
m_declDefLink->targetFile->fileName());
if (baseTextDocument() != targetDocument) {
- if (TextEditor::BaseTextDocument *baseTextDocument = qobject_cast<TextEditor::BaseTextDocument *>(targetDocument))
- disconnect(baseTextDocument->document(), SIGNAL(contentsChanged()),
+ if (TextEditor::ITextEditorDocument *textEditorDocument = qobject_cast<TextEditor::ITextEditorDocument *>(targetDocument))
+ disconnect(textEditorDocument, SIGNAL(contentsChanged()),
this, SLOT(abortDeclDefLink()));
}
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp
index faf2af37fe..3e1619117c 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.cpp
+++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp
@@ -142,7 +142,7 @@ CppEditorSupport::CppEditorSupport(CppModelManager *modelManager, BaseTextEditor
connect(m_updateEditorTimer, SIGNAL(timeout()),
this, SLOT(updateEditorNow()));
- connect(m_textEditor, SIGNAL(contentsChanged()), this, SLOT(updateDocument()));
+ connect(m_textEditor->document(), SIGNAL(contentsChanged()), this, SLOT(updateDocument()));
connect(this, SIGNAL(diagnosticsChanged()), this, SLOT(onDiagnosticsChanged()));
connect(m_textEditor->document(), SIGNAL(mimeTypeChanged()),
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.h b/src/plugins/cpptools/cpptoolseditorsupport.h
index ab7dc8e4a2..f9ba876256 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.h
+++ b/src/plugins/cpptools/cpptoolseditorsupport.h
@@ -59,7 +59,7 @@ class CppCompletionAssistProvider;
* its document.
*
* The following steps are taken:
- * 1. the text editor fires a contentsChanged() signal that triggers updateDocument
+ * 1. the text editor document fires a contentsChanged() signal that triggers updateDocument
* 2. update document will start a timer, or reset the timer if it was already running. This way
* subsequent updates (e.g. keypresses) get bunched together instead of running the subsequent
* actions for every key press
diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp
index 0cf2695503..0820dd4b66 100644
--- a/src/plugins/qmljseditor/qmljseditorplugin.cpp
+++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp
@@ -311,14 +311,12 @@ void QmlJSEditorPlugin::currentEditorChanged(Core::IEditor *editor)
newTextEditor = qobject_cast<QmlJSTextEditorWidget *>(editor->widget());
if (m_currentEditor) {
- disconnect(m_currentEditor.data(), SIGNAL(contentsChanged()),
- this, SLOT(checkCurrentEditorSemanticInfoUpToDate()));
- disconnect(m_currentEditor.data(), SIGNAL(semanticInfoUpdated()),
- this, SLOT(checkCurrentEditorSemanticInfoUpToDate()));
+ m_currentEditor->baseTextDocument()->disconnect(this);
+ m_currentEditor->disconnect(this);
}
m_currentEditor = newTextEditor;
if (newTextEditor) {
- connect(newTextEditor, SIGNAL(contentsChanged()),
+ connect(newTextEditor->baseTextDocument(), SIGNAL(contentsChanged()),
this, SLOT(checkCurrentEditorSemanticInfoUpToDate()));
connect(newTextEditor, SIGNAL(semanticInfoUpdated()),
this, SLOT(checkCurrentEditorSemanticInfoUpToDate()));
diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp
index 9d9a395d06..adba636f4f 100644
--- a/src/plugins/texteditor/basetextdocument.cpp
+++ b/src/plugins/texteditor/basetextdocument.cpp
@@ -84,6 +84,7 @@ BaseTextDocumentPrivate::BaseTextDocumentPrivate(BaseTextDocument *q) :
BaseTextDocument::BaseTextDocument() : d(new BaseTextDocumentPrivate(this))
{
connect(d->m_document, SIGNAL(modificationChanged(bool)), this, SIGNAL(changed()));
+ connect(d->m_document, SIGNAL(contentsChanged()), this, SIGNAL(contentsChanged()));
// set new document layout
QTextOption opt = d->m_document->defaultTextOption();
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index dbed95f3ca..9358f93ba8 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -509,8 +509,6 @@ BaseTextEditor *BaseTextEditorWidget::editor() const
if (!d->m_editor) {
d->m_editor = const_cast<BaseTextEditorWidget *>(this)->createEditor();
d->m_codeAssistant->configure(d->m_editor);
- connect(this, SIGNAL(textChanged()),
- d->m_editor, SIGNAL(contentsChanged()));
}
return d->m_editor;
}
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index 4f8d97288d..5d65cd96ec 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -326,9 +326,6 @@ signals:
void assistFinished();
void readOnlyChanged();
- // ITextEditor
- void contentsChanged();
-
protected:
bool event(QEvent *e);
void keyPressEvent(QKeyEvent *e);
diff --git a/src/plugins/texteditor/itexteditor.h b/src/plugins/texteditor/itexteditor.h
index 385a82d12b..c75ba51d2c 100644
--- a/src/plugins/texteditor/itexteditor.h
+++ b/src/plugins/texteditor/itexteditor.h
@@ -86,6 +86,9 @@ public:
virtual QChar characterAt(int pos) const = 0;
virtual ITextMarkable *markableInterface() const = 0;
+
+signals:
+ void contentsChanged();
};
class TEXTEDITOR_EXPORT ITextEditor : public Core::IEditor
@@ -140,7 +143,6 @@ public:
};
signals:
- void contentsChanged();
void markRequested(TextEditor::ITextEditor *editor, int line, TextEditor::ITextEditor::MarkRequestKind kind);
void markContextMenuRequested(TextEditor::ITextEditor *editor, int line, QMenu *menu);
void tooltipOverrideRequested(TextEditor::ITextEditor *editor, const QPoint &globalPos, int position, bool *handled);