forked from qt-creator/qt-creator
CppEditor: Start renaming the new function parameter
... in the ExtractLiteralAsParameter quickfix. It's unlikely that the user wants to keep the generic default name. Fixes: QTCREATORBUG-25104 Change-Id: Ic354f20c27da43664bcb3c2839e981c176aaf821 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -5821,6 +5821,10 @@ public:
|
|||||||
}
|
}
|
||||||
currentFile->setChangeSet(changes);
|
currentFile->setChangeSet(changes);
|
||||||
currentFile->apply();
|
currentFile->apply();
|
||||||
|
QTextCursor c = currentFile->cursor();
|
||||||
|
c.setPosition(c.position() - parameterName().length());
|
||||||
|
editor()->setTextCursor(c);
|
||||||
|
editor()->renameSymbolUnderCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -5842,6 +5846,8 @@ private:
|
|||||||
m_typeName = overview.prettyType(items.first().type());
|
m_typeName = overview.prettyType(items.first().type());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString parameterName() { return QLatin1String("newParameter"); }
|
||||||
|
|
||||||
QString parameterDeclarationTextToInsert(FunctionDeclaratorAST *ast) const
|
QString parameterDeclarationTextToInsert(FunctionDeclaratorAST *ast) const
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
@@ -5850,7 +5856,7 @@ private:
|
|||||||
str += m_typeName;
|
str += m_typeName;
|
||||||
if (!m_typeName.endsWith(QLatin1Char('*')))
|
if (!m_typeName.endsWith(QLatin1Char('*')))
|
||||||
str += QLatin1Char(' ');
|
str += QLatin1Char(' ');
|
||||||
str += QLatin1String("newParameter");
|
str += parameterName();
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user