CppTools: Fix completing qt5 style signals/slots in connect()

* Fix qualifying the member function, take namespace into account
* Fallback to usual completion if we cannot provide anything
* Ensure that the completion is not triggered outside connect() calls
* Change to a two step process:

    1. connect(obj, &         // offer class name completion
    2. connect(obj, &N::Foo:: // offer signal completions

  ...same for the 4th. argument.

Change-Id: Ifa4c74cde1b96ec7c544daaeefc47c4efdd8294a
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2015-02-17 17:47:41 +01:00
committed by Erik Verbruggen
parent f3a2795c3b
commit 21e9893b4b
3 changed files with 303 additions and 76 deletions

View File

@@ -139,7 +139,9 @@ private:
CompleteQt5Slots,
};
bool completeQtMethod(const QList<CPlusPlus::LookupItem> &results, CompleteQtMethodMode type);
void globalCompletion(CPlusPlus::Scope *scope);
bool completeQtMethodClassName(const QList<CPlusPlus::LookupItem> &results,
CPlusPlus::Scope *cursorScope);
bool globalCompletion(CPlusPlus::Scope *scope);
void addCompletionItem(const QString &text,
const QIcon &icon = QIcon(),
@@ -155,9 +157,11 @@ private:
QSet<QString> *definedMacros);
enum {
CompleteQt5SignalTrigger = CPlusPlus::T_LAST_TOKEN + 1,
CompleteQtSlotTrigger
CompleteQt5SignalOrSlotClassNameTrigger = CPlusPlus::T_LAST_TOKEN + 1,
CompleteQt5SignalTrigger,
CompleteQt5SlotTrigger
};
CPlusPlus::LanguageFeatures m_languageFeatures;
QScopedPointer<const CppCompletionAssistInterface> m_interface;
QScopedPointer<CppAssistProposalModel> m_model;