C++: prevent cloning the QTextDocument on the UI thread.

Now the document contents (the text) is passed to the background thread,
which in turn will recreate the text document.

Change-Id: I7af47348fe162b53b8b440f1561a9919bf3c381a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2013-02-26 11:15:38 +01:00
committed by Erik Verbruggen
parent 53e8e0fb7b
commit ff6e100824
5 changed files with 23 additions and 11 deletions

View File

@@ -132,6 +132,8 @@ private:
// --------------------
const QChar CodeAssistantPrivate::m_null;
static const int AutomaticProposalTimerInterval = 400;
CodeAssistantPrivate::CodeAssistantPrivate(CodeAssistant *assistant)
: m_q(assistant)
, m_textEditor(0)
@@ -142,7 +144,7 @@ CodeAssistantPrivate::CodeAssistantPrivate(CodeAssistant *assistant)
, m_settings(TextEditorSettings::instance()->completionSettings())
{
m_automaticProposalTimer.setSingleShot(true);
m_automaticProposalTimer.setInterval(400);
m_automaticProposalTimer.setInterval(AutomaticProposalTimerInterval);
connect(&m_automaticProposalTimer, SIGNAL(timeout()), this, SLOT(automaticProposalTimeout()));
connect(TextEditorSettings::instance(),
@@ -248,7 +250,7 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason,
m_requestRunner = new ProcessorRunner;
connect(m_requestRunner, SIGNAL(finished()), this, SLOT(proposalComputed()));
connect(m_requestRunner, SIGNAL(finished()), this, SLOT(finalizeRequest()));
assistInterface->detach(m_requestRunner);
assistInterface->prepareForAsyncUse();
m_requestRunner->setReason(reason);
m_requestRunner->setProcessor(processor);
m_requestRunner->setAssistInterface(assistInterface);