summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/cppeditor/cppinsertvirtualmethods.cpp2
-rw-r--r--src/plugins/cppeditor/cppquickfixes.cpp14
-rw-r--r--src/plugins/cpptools/insertionpointlocator.cpp16
3 files changed, 11 insertions, 21 deletions
diff --git a/src/plugins/cppeditor/cppinsertvirtualmethods.cpp b/src/plugins/cppeditor/cppinsertvirtualmethods.cpp
index 21d611182d..beb25310e3 100644
--- a/src/plugins/cppeditor/cppinsertvirtualmethods.cpp
+++ b/src/plugins/cppeditor/cppinsertvirtualmethods.cpp
@@ -735,7 +735,7 @@ public:
const QString accessSpecString =
InsertionPointLocator::accessSpecToString(funcItem->accessSpec);
if (accessSpecString != lastAccessSpecString) {
- declaration = accessSpecString + declaration;
+ declaration = accessSpecString + QLatin1String(":\n") + declaration;
if (!lastAccessSpecString.isEmpty()) // separate if not direct after the comment
declaration = QLatin1String("\n") + declaration;
lastAccessSpecString = accessSpecString;
diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp
index a9effc647b..eb9e1cd51a 100644
--- a/src/plugins/cppeditor/cppquickfixes.cpp
+++ b/src/plugins/cppeditor/cppquickfixes.cpp
@@ -2367,19 +2367,9 @@ public:
, m_xsSpec(xsSpec)
, m_decl(decl)
{
- QString type;
- switch (xsSpec) {
- case InsertionPointLocator::Public: type = QLatin1String("public"); break;
- case InsertionPointLocator::Protected: type = QLatin1String("protected"); break;
- case InsertionPointLocator::Private: type = QLatin1String("private"); break;
- case InsertionPointLocator::PublicSlot: type = QLatin1String("public slot"); break;
- case InsertionPointLocator::ProtectedSlot: type = QLatin1String("protected slot"); break;
- case InsertionPointLocator::PrivateSlot: type = QLatin1String("private slot"); break;
- default: break;
- }
-
setDescription(QCoreApplication::translate("CppEditor::InsertDeclOperation",
- "Add %1 Declaration").arg(type));
+ "Add %1 Declaration")
+ .arg(InsertionPointLocator::accessSpecToString(xsSpec)));
}
void perform()
diff --git a/src/plugins/cpptools/insertionpointlocator.cpp b/src/plugins/cpptools/insertionpointlocator.cpp
index 767a67cd6d..5126b7b4bc 100644
--- a/src/plugins/cpptools/insertionpointlocator.cpp
+++ b/src/plugins/cpptools/insertionpointlocator.cpp
@@ -135,7 +135,7 @@ protected:
if (needsLeadingEmptyLine)
prefix += QLatin1String("\n");
if (needsPrefix)
- prefix += InsertionPointLocator::accessSpecToString(_xsSpec);
+ prefix += InsertionPointLocator::accessSpecToString(_xsSpec) + QLatin1String(":\n");
QString suffix;
if (needsSuffix)
@@ -278,25 +278,25 @@ QString InsertionPointLocator::accessSpecToString(InsertionPointLocator::AccessS
switch (xsSpec) {
default:
case InsertionPointLocator::Public:
- return QLatin1String("public:\n");
+ return QLatin1String("public");
case InsertionPointLocator::Protected:
- return QLatin1String("protected:\n");
+ return QLatin1String("protected");
case InsertionPointLocator::Private:
- return QLatin1String("private:\n");
+ return QLatin1String("private");
case InsertionPointLocator::PublicSlot:
- return QLatin1String("public slots:\n");
+ return QLatin1String("public slots");
case InsertionPointLocator::ProtectedSlot:
- return QLatin1String("protected slots:\n");
+ return QLatin1String("protected slots");
case InsertionPointLocator::PrivateSlot:
- return QLatin1String("private slots:\n");
+ return QLatin1String("private slots");
case InsertionPointLocator::Signals:
- return QLatin1String("signals:\n");
+ return QLatin1String("signals");
}
}