forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.14'
Change-Id: I6e67f23464fc14dda5a659004f0aa360d6f5d25f
This commit is contained in:
@@ -139,15 +139,17 @@ QList<AssistProposalItemInterface *> ClangCompletionAssistProcessor::toAssistPro
|
||||
considerOnlySignals = CppTools::CppModelManager::instance()
|
||||
->positionRequiresSignal(m_interface->filePath().toString(), m_content, m_position);
|
||||
}
|
||||
|
||||
for (const CodeCompletion &codeCompletion : completions) {
|
||||
if (considerOnlySignals && codeCompletion.completionKind
|
||||
!= CodeCompletion::SignalCompletionKind) {
|
||||
continue;
|
||||
}
|
||||
if (codeCompletion.text.isEmpty())
|
||||
continue; // It's an OverloadCandidate which has text but no typedText.
|
||||
|
||||
if (considerOnlySignals
|
||||
&& codeCompletion.completionKind != CodeCompletion::ClassCompletionKind
|
||||
&& codeCompletion.completionKind != CodeCompletion::NamespaceCompletionKind
|
||||
&& codeCompletion.completionKind != CodeCompletion::SignalCompletionKind) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't offer symbols that are not accessible here.
|
||||
if (codeCompletion.availability == CodeCompletion::NotAvailable
|
||||
|| codeCompletion.availability == CodeCompletion::NotAccessible) {
|
||||
|
||||
@@ -765,27 +765,29 @@ void ClangCodeCompletionTest::testSignalCompletion_data()
|
||||
QTest::addColumn<QByteArray>("customContents");
|
||||
QTest::addColumn<QByteArrayList>("hits");
|
||||
|
||||
// libclang mis-reports CXCursor_ClassDecl instead of CXCursor_Constructor, so the lists
|
||||
// below include the class name.
|
||||
QTest::addRow("positive: connect() on QObject class")
|
||||
<< QByteArray("int main() { QObject::connect(dummy, QObject::")
|
||||
<< QByteArrayList{"aSignal", "anotherSignal"};
|
||||
<< QByteArrayList{"aSignal", "anotherSignal", "QObject"};
|
||||
QTest::addRow("positive: connect() on QObject object")
|
||||
<< QByteArray("int main() { QObject o; o.connect(dummy, QObject::")
|
||||
<< QByteArrayList{"aSignal", "anotherSignal"};
|
||||
<< QByteArrayList{"aSignal", "anotherSignal", "QObject"};
|
||||
QTest::addRow("positive: connect() on QObject pointer")
|
||||
<< QByteArray("int main() { QObject *o; o->connect(dummy, QObject::")
|
||||
<< QByteArrayList{"aSignal", "anotherSignal"};
|
||||
<< QByteArrayList{"aSignal", "anotherSignal", "QObject"};
|
||||
QTest::addRow("positive: connect() on QObject rvalue")
|
||||
<< QByteArray("int main() { QObject().connect(dummy, QObject::")
|
||||
<< QByteArrayList{"aSignal", "anotherSignal"};
|
||||
<< QByteArrayList{"aSignal", "anotherSignal", "QObject"};
|
||||
QTest::addRow("positive: connect() on QObject pointer rvalue")
|
||||
<< QByteArray("int main() { (new QObject)->connect(dummy, QObject::")
|
||||
<< QByteArrayList{"aSignal", "anotherSignal"};
|
||||
<< QByteArrayList{"aSignal", "anotherSignal", "QObject"};
|
||||
QTest::addRow("positive: disconnect() on QObject")
|
||||
<< QByteArray("int main() { QObject::disconnect(dummy, QObject::")
|
||||
<< QByteArrayList{"aSignal", "anotherSignal"};
|
||||
<< QByteArrayList{"aSignal", "anotherSignal", "QObject"};
|
||||
QTest::addRow("positive: connect() in member function of derived class")
|
||||
<< QByteArray("void DerivedFromQObject::alsoNotASignal() { connect(this, DerivedFromQObject::")
|
||||
<< QByteArrayList{"aSignal", "anotherSignal", "myOwnSignal"};
|
||||
<< QByteArrayList{"aSignal", "anotherSignal", "myOwnSignal", "QObject", "DerivedFromQObject"};
|
||||
|
||||
const QByteArrayList allQObjectFunctions{"aSignal", "anotherSignal", "notASignal", "connect",
|
||||
"disconnect", "QObject", "~QObject", "operator="};
|
||||
|
||||
Reference in New Issue
Block a user