Skip to content
Snippets Groups Projects
Commit 3fb98a75 authored by Milian Wolff's avatar Milian Wolff
Browse files

Do not offer signature assistant for changes in Qt signals.

Based on the work of Rolf Eike Beer minus the regression of
not showing the assistant for non-Qt function declarations.

Sorry for taking so long for this :-/

BUG: 315167
REVIEW: 109197
parent e434ac2f
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@
#include "cppduchain.h"
#include "renameaction.h"
#include "qtfunctiondeclaration.h"
using namespace KDevelop;
using namespace Cpp;
......@@ -83,6 +84,13 @@ AdaptDefinitionSignatureAssistant::AdaptDefinitionSignatureAssistant(KTextEditor
if(!funDecl || !funDecl->type<FunctionType>())
return;
if(QtFunctionDeclaration* classFun = dynamic_cast<QtFunctionDeclaration*>(funDecl)) {
if (classFun->isSignal()) {
// do not offer to change signature of a signal, as the implementation will be generated by moc
return;
}
}
Declaration* otherSide = 0;
FunctionDefinition* definition = dynamic_cast<FunctionDefinition*>(funDecl);
if (definition)
......@@ -216,6 +224,12 @@ void AdaptDefinitionSignatureAssistant::parseJobFinished(KDevelop::ParseJob* job
DUContext *functionCtxt = DUChainUtils::getFunctionContext(functionDecl);
if (!functionCtxt)
return;
if(QtFunctionDeclaration* classFun = dynamic_cast<QtFunctionDeclaration*>(functionDecl)) {
if (classFun->isSignal()) {
// do not offer to change signature of a signal, as the implementation will be generated by moc
return;
}
}
//ParseJob having finished, get the signature that was modified
Signature newSignature = getDeclarationSignature(functionDecl, functionCtxt, false);
......@@ -229,7 +243,10 @@ void AdaptDefinitionSignatureAssistant::parseJobFinished(KDevelop::ParseJob* job
setDefaultParams(newSignature, oldPositions); //restore default parameters before updating the declarations
else
renameActions = getRenameActions(newSignature, oldPositions); //rename as needed when updating the definition
addAction(IAssistantAction::Ptr(new AdaptSignatureAction(m_otherSideId, m_otherSideTopContext, m_oldSignature, newSignature, m_editingDefinition, renameActions)));
addAction(IAssistantAction::Ptr(new AdaptSignatureAction(m_otherSideId, m_otherSideTopContext,
m_oldSignature, newSignature,
m_editingDefinition, renameActions)));
emit actionsChanged();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment