forked from qt-creator/qt-creator
CppEditor: Fix following signals/slots in old-style connects
... if the first argument is a call to a function returning a pointer to QObject. Fixes: QTCREATORBUG-13265 Change-Id: I12c2d07331a0c6dca56ad55c518240fd74be3dca Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1085,7 +1085,12 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
|||||||
qDebug() << "- after typedef resolving:" << oo(ty);
|
qDebug() << "- after typedef resolving:" << oo(ty);
|
||||||
|
|
||||||
if (accessOp == T_ARROW) {
|
if (accessOp == T_ARROW) {
|
||||||
if (PointerType *ptrTy = ty->asPointerType()) {
|
PointerType *ptrTy = ty->asPointerType();
|
||||||
|
if (!ptrTy) {
|
||||||
|
if (Function * const func = ty->asFunctionType())
|
||||||
|
ptrTy = func->returnType()->asPointerType();
|
||||||
|
}
|
||||||
|
if (ptrTy) {
|
||||||
FullySpecifiedType type = ptrTy->elementType();
|
FullySpecifiedType type = ptrTy->elementType();
|
||||||
if (ClassOrNamespace *binding
|
if (ClassOrNamespace *binding
|
||||||
= findClassForTemplateParameterInExpressionScope(r.binding(),
|
= findClassForTemplateParameterInExpressionScope(r.binding(),
|
||||||
|
@@ -85,6 +85,7 @@ private slots:
|
|||||||
|
|
||||||
void test_FollowSymbolUnderCursor_QObject_connect_data();
|
void test_FollowSymbolUnderCursor_QObject_connect_data();
|
||||||
void test_FollowSymbolUnderCursor_QObject_connect();
|
void test_FollowSymbolUnderCursor_QObject_connect();
|
||||||
|
void test_FollowSymbolUnderCursor_QObject_oldStyleConnect();
|
||||||
|
|
||||||
void test_FollowSymbolUnderCursor_classOperator_onOperatorToken_data();
|
void test_FollowSymbolUnderCursor_classOperator_onOperatorToken_data();
|
||||||
void test_FollowSymbolUnderCursor_classOperator_onOperatorToken();
|
void test_FollowSymbolUnderCursor_classOperator_onOperatorToken();
|
||||||
|
@@ -1309,6 +1309,26 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_QObject_connect()
|
|||||||
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source));
|
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CppEditorPlugin::test_FollowSymbolUnderCursor_QObject_oldStyleConnect()
|
||||||
|
{
|
||||||
|
const QByteArray source =
|
||||||
|
"class O : public QObject {\n"
|
||||||
|
" Q_OBJECT\n"
|
||||||
|
"signals:\n"
|
||||||
|
" void $theSignal();\n"
|
||||||
|
"};\n"
|
||||||
|
"struct S {\n"
|
||||||
|
" O* o();\n"
|
||||||
|
"};\n"
|
||||||
|
"int main()\n"
|
||||||
|
"{\n"
|
||||||
|
" S s;\n"
|
||||||
|
" QObject::connect(s.o(), SIGNAL(@theSignal()), s.o(), SIGNAL(theSignal()));\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
F2TestCase(F2TestCase::FollowSymbolUnderCursorAction, singleDocument(source));
|
||||||
|
}
|
||||||
|
|
||||||
void CppEditorPlugin::test_FollowSymbolUnderCursor_classOperator_onOperatorToken_data()
|
void CppEditorPlugin::test_FollowSymbolUnderCursor_classOperator_onOperatorToken_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<bool>("toDeclaration");
|
QTest::addColumn<bool>("toDeclaration");
|
||||||
|
Reference in New Issue
Block a user