diff options
author | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2014-02-18 12:59:57 -0300 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2014-02-21 17:46:35 +0100 |
commit | bbdfd0fb8278dd20ec2d7609437032ed633db375 (patch) | |
tree | 8fcff77bf293ef8897326bf4c74d26c7b14928f9 /src/plugins/cpptools/cppcompletionassist.h | |
parent | c0eaed863025543bd36268df7b588576d5696dd1 (diff) |
CppTools: Do not block GUI thread for completions
The GUI was blocked while waiting for the parsed document. Now the
blocking operation is executed in the completion thread.
Task-number: QTCREATORBUG-11037
Task-number: QTCREATORBUG-11433
Change-Id: Ia7c1b1b7eea0ba75010ff667ba05273c62c18491
Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletionassist.h')
-rw-r--r-- | src/plugins/cpptools/cppcompletionassist.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/plugins/cpptools/cppcompletionassist.h b/src/plugins/cpptools/cppcompletionassist.h index eb5806ea4f..0e0268b74b 100644 --- a/src/plugins/cpptools/cppcompletionassist.h +++ b/src/plugins/cpptools/cppcompletionassist.h @@ -39,6 +39,7 @@ # include <cplusplus/Symbol.h> #endif +#include <texteditor/basetexteditor.h> #include <texteditor/codeassist/basicproposalitemlistmodel.h> #include <texteditor/codeassist/defaultassistinterface.h> #include <texteditor/codeassist/iassistprocessor.h> @@ -170,6 +171,16 @@ private: class CppCompletionAssistInterface : public TextEditor::DefaultAssistInterface { public: + CppCompletionAssistInterface(TextEditor::BaseTextEditor *editor, + QTextDocument *textDocument, + int position, + TextEditor::AssistReason reason) + : TextEditor::DefaultAssistInterface(textDocument, position, editor->document()->filePath(), + reason) + , m_editor(editor) + , m_gotCppSpecifics(false) + {} + CppCompletionAssistInterface(QTextDocument *textDocument, int position, const QString &fileName, @@ -178,19 +189,25 @@ public: const QStringList &includePaths, const QStringList &frameworkPaths) : TextEditor::DefaultAssistInterface(textDocument, position, fileName, reason) + , m_editor(0) + , m_gotCppSpecifics(true) , m_snapshot(snapshot) , m_includePaths(includePaths) , m_frameworkPaths(frameworkPaths) {} - const CPlusPlus::Snapshot &snapshot() const { return m_snapshot; } - const QStringList &includePaths() const { return m_includePaths; } - const QStringList &frameworkPaths() const { return m_frameworkPaths; } + const CPlusPlus::Snapshot &snapshot() const { getCppSpecifics(); return m_snapshot; } + const QStringList &includePaths() const { getCppSpecifics(); return m_includePaths; } + const QStringList &frameworkPaths() const { getCppSpecifics(); return m_frameworkPaths; } private: - CPlusPlus::Snapshot m_snapshot; - QStringList m_includePaths; - QStringList m_frameworkPaths; + void getCppSpecifics() const; + + TextEditor::BaseTextEditor *m_editor; + mutable bool m_gotCppSpecifics; + mutable CPlusPlus::Snapshot m_snapshot; + mutable QStringList m_includePaths; + mutable QStringList m_frameworkPaths; }; } // Internal |