diff --git a/src/plugins/cppeditor/cppchecksymbols.cpp b/src/plugins/cppeditor/cppchecksymbols.cpp index e7be40371f9..b5f5c01df32 100644 --- a/src/plugins/cppeditor/cppchecksymbols.cpp +++ b/src/plugins/cppeditor/cppchecksymbols.cpp @@ -507,7 +507,9 @@ bool CheckSymbols::visit(MemberAccessAST *ast) const Token end = tokenAt(ast->lastToken() - 1); const QByteArray expression = _doc->source().mid(start.begin(), end.end() - start.begin()); - const QList candidates = typeOfExpression(expression, enclosingScope(), TypeOfExpression::Preprocess); + const QList candidates = + typeOfExpression(QLatin1String(expression), enclosingScope(), + TypeOfExpression::Preprocess); addClassMember(candidates, ast->member_name); } } @@ -531,8 +533,9 @@ bool CheckSymbols::visit(CallAST *ast) if (maybeVirtualMethod(access->member_name->name)) { const QByteArray expression = textOf(access); - const QList candidates = typeOfExpression(expression, enclosingScope(), - TypeOfExpression::Preprocess); + const QList candidates = + typeOfExpression(QLatin1String(expression), enclosingScope(), + TypeOfExpression::Preprocess); NameAST *memberName = access->member_name; if (QualifiedNameAST *q = memberName->asQualifiedName()) @@ -548,9 +551,9 @@ bool CheckSymbols::visit(CallAST *ast) if (QualifiedNameAST *q = exprName->asQualifiedName()) exprName = q->unqualified_name; - const QList candidates = typeOfExpression(textOf(idExpr), enclosingScope(), - TypeOfExpression::Preprocess); - + const QList candidates = + typeOfExpression(QLatin1String(textOf(idExpr)), enclosingScope(), + TypeOfExpression::Preprocess); addVirtualMethod(candidates, exprName, argumentCount); } } diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 0b5f2eaea18..6411264261d 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -586,7 +586,7 @@ CppModelManagerInterface *CPPEditorWidget::modelManager() const void CPPEditorWidget::setMimeType(const QString &mt) { BaseTextEditorWidget::setMimeType(mt); - setObjCEnabled(mt == CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE); + setObjCEnabled(mt == QLatin1String(CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE)); } void CPPEditorWidget::setObjCEnabled(bool onoff) @@ -1546,7 +1546,7 @@ void CPPEditorWidget::contextMenuEvent(QContextMenuEvent *e) foreach (QAction *action, contextMenu->actions()) { menu->addAction(action); - if (action->objectName() == Constants::M_REFACTORING_MENU_INSERTION_POINT) + if (action->objectName() == QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT)) menu->addMenu(quickFixMenu); } @@ -2271,10 +2271,10 @@ bool CPPEditorWidget::handleDocumentationComment(QKeyEvent *e) if (m_commentsSettings.m_enableDoxygen && cursor.positionInBlock() >= 3) { const int pos = cursor.position(); - if (characterAt(pos - 3) == QChar('/') - && characterAt(pos - 2) == QChar('*') - && (characterAt(pos - 1) == QChar('*') - || characterAt(pos - 1) == QChar('!'))) { + if (characterAt(pos - 3) == QLatin1Char('/') + && characterAt(pos - 2) == QLatin1Char('*') + && (characterAt(pos - 1) == QLatin1Char('*') + || characterAt(pos - 1) == QLatin1Char('!'))) { CppTools::DoxygenGenerator doxygen; doxygen.setAddLeadingAsterisks(m_commentsSettings.m_leadingAsterisks); doxygen.setGenerateBrief(m_commentsSettings.m_generateBrief); diff --git a/src/plugins/cppeditor/cppelementevaluator.cpp b/src/plugins/cppeditor/cppelementevaluator.cpp index 219b6987261..bde17af2ff8 100644 --- a/src/plugins/cppeditor/cppelementevaluator.cpp +++ b/src/plugins/cppeditor/cppelementevaluator.cpp @@ -157,8 +157,7 @@ bool CppElementEvaluator::matchMacroInUse(const CPlusPlus::Document::Ptr &docume foreach (const Document::MacroUse &use, document->macroUses()) { if (use.contains(pos)) { const unsigned begin = use.begin(); - const QString &name = use.macro().name(); - if (pos < begin + name.length()) { + if (pos < begin + use.macro().name().length()) { m_element = QSharedPointer(new CppMacro(use.macro())); return true; } @@ -317,8 +316,9 @@ const QString &CppInclude::fileName() const CppMacro::CppMacro(const Macro ¯o) : CppElement() { setHelpCategory(TextEditor::HelpItem::Macro); - setHelpIdCandidates(QStringList(macro.name())); - setHelpMark(macro.name()); + const QString macroName = QLatin1String(macro.name()); + setHelpIdCandidates(QStringList(macroName)); + setHelpMark(macroName); setLink(CPPEditorWidget::Link(macro.fileName(), macro.line())); setTooltip(macro.toStringWithLineBreaks()); } diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp index fa4a4bfb9ed..fa6f9442c41 100644 --- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp +++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp @@ -809,7 +809,7 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ // don't change the name if it's in a comment if (hasCommentedName(targetFile->cppDocument()->translationUnit(), - targetFile->cppDocument()->source(), + QLatin1String(targetFile->cppDocument()->source()), targetFunctionDeclarator, existingParamIndex)) replacementName = 0; diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index 49c42784d28..2c42ba1e667 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -263,48 +263,65 @@ bool CppHighlighter::isPPKeyword(const QStringRef &text) const switch (text.length()) { case 2: - if (text.at(0) == 'i' && text.at(1) == 'f') + if (text.at(0) == QLatin1Char('i') && text.at(1) == QLatin1Char('f')) return true; break; case 4: - if (text.at(0) == 'e' && text == QLatin1String("elif")) - return true; - else if (text.at(0) == 'e' && text == QLatin1String("else")) + if (text.at(0) == QLatin1Char('e') + && (text == QLatin1String("elif") || text == QLatin1String("else"))) return true; break; case 5: - if (text.at(0) == 'i' && text == QLatin1String("ifdef")) - return true; - else if (text.at(0) == 'u' && text == QLatin1String("undef")) - return true; - else if (text.at(0) == 'e' && text == QLatin1String("endif")) - return true; - else if (text.at(0) == 'e' && text == QLatin1String("error")) - return true; + switch (text.at(0).toLatin1()) { + case 'i': + if (text == QLatin1String("ifdef")) + return true; + break; + case 'u': + if (text == QLatin1String("undef")) + return true; + break; + case 'e': + if (text == QLatin1String("endif") || text == QLatin1String("error")) + return true; + break; + } break; case 6: - if (text.at(0) == 'i' && text == QLatin1String("ifndef")) - return true; - if (text.at(0) == 'i' && text == QLatin1String("import")) - return true; - else if (text.at(0) == 'd' && text == QLatin1String("define")) - return true; - else if (text.at(0) == 'p' && text == QLatin1String("pragma")) - return true; + switch (text.at(0).toLatin1()) { + case 'i': + if (text == QLatin1String("ifndef") || text == QLatin1String("import")) + return true; + break; + case 'd': + if (text == QLatin1String("define")) + return true; + break; + case 'p': + if (text == QLatin1String("pragma")) + return true; + break; + } break; case 7: - if (text.at(0) == 'i' && text == QLatin1String("include")) - return true; - else if (text.at(0) == 'w' && text == QLatin1String("warning")) - return true; + switch (text.at(0).toLatin1()) { + case 'i': + if (text == QLatin1String("include")) + return true; + break; + case 'w': + if (text == QLatin1String("warning")) + return true; + break; + } break; case 12: - if (text.at(0) == 'i' && text == QLatin1String("include_next")) + if (text.at(0) == QLatin1Char('i') && text == QLatin1String("include_next")) return true; break; @@ -319,29 +336,39 @@ bool CppHighlighter::isQtKeyword(const QStringRef &text) const { switch (text.length()) { case 4: - if (text.at(0) == 'e' && text == QLatin1String("emit")) - return true; - else if (text.at(0) == 'S' && text == QLatin1String("SLOT")) - return true; + switch (text.at(0).toLatin1()) { + case 'e': + if (text == QLatin1String("emit")) + return true; + break; + case 'S': + if (text == QLatin1String("SLOT")) + return true; + break; + } break; case 5: - if (text.at(0) == 's' && text == QLatin1String("slots")) + if (text.at(0) == QLatin1Char('s') && text == QLatin1String("slots")) return true; break; case 6: - if (text.at(0) == 'S' && text == QLatin1String("SIGNAL")) + if (text.at(0) == QLatin1Char('S') && text == QLatin1String("SIGNAL")) return true; break; case 7: - if (text.at(0) == 's' && text == QLatin1String("signals")) - return true; - else if (text.at(0) == 'f' && text == QLatin1String("foreach")) - return true; - else if (text.at(0) == 'f' && text == QLatin1String("forever")) - return true; + switch (text.at(0).toLatin1()) { + case 's': + if (text == QLatin1String("signals")) + return true; + break; + case 'f': + if (text == QLatin1String("foreach") || text == QLatin1String("forever")) + return true; + break; + } break; default: diff --git a/src/plugins/cppeditor/cppinsertdecldef.cpp b/src/plugins/cppeditor/cppinsertdecldef.cpp index 361a0a1524c..1ec5e0d71d0 100644 --- a/src/plugins/cppeditor/cppinsertdecldef.cpp +++ b/src/plugins/cppeditor/cppinsertdecldef.cpp @@ -276,7 +276,7 @@ public: // rewrite the function name QString name = oo(LookupContext::minimalName(m_decl, targetCoN, control)); - QString defText = oo.prettyType(tn, name) + "\n{\n}"; + QString defText = oo.prettyType(tn, name) + QLatin1String("\n{\n}"); int targetPos = targetFile->position(m_loc.line(), m_loc.column()); int targetPos2 = qMax(0, targetFile->position(m_loc.line(), 1) - 1); @@ -459,11 +459,11 @@ public: // Write declaration, if necessary. if (matchingClass) { InsertionPointLocator locator(refactoring); + const QString fileName = QLatin1String(matchingClass->fileName()); const InsertionLocation &location = - locator.methodDeclarationInClass(matchingClass->fileName(), - matchingClass, + locator.methodDeclarationInClass(fileName, matchingClass, InsertionPointLocator::Public); - CppTools::CppRefactoringFilePtr declFile = refactoring.file(matchingClass->fileName()); + CppTools::CppRefactoringFilePtr declFile = refactoring.file(fileName); change.clear(); position = declFile->position(location.line(), location.column()); change.insert(position, funcDecl); diff --git a/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp b/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp index 25ec9aa3624..2834ec3720b 100644 --- a/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp +++ b/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp @@ -42,6 +42,8 @@ #include #include +#include + using namespace CPlusPlus; using namespace CppTools; using namespace TextEditor; @@ -79,19 +81,19 @@ QList InsertQtPropertyMembers::match( int generateFlags = 0; for (QtPropertyDeclarationItemListAST *it = qtPropertyDeclaration->property_declaration_item_list; it; it = it->next) { - const QString tokenString = file->tokenAt(it->value->item_name_token).spell(); - if (tokenString == QLatin1String("READ")) { + const char *tokenString = file->tokenAt(it->value->item_name_token).spell(); + if (!qstrcmp(tokenString, "READ")) { getterName = file->textOf(it->value->expression); generateFlags |= GenerateGetter; - } else if (tokenString == QLatin1String("WRITE")) { + } else if (!qstrcmp(tokenString, "WRITE")) { setterName = file->textOf(it->value->expression); generateFlags |= GenerateSetter; - } else if (tokenString == QLatin1String("NOTIFY")) { + } else if (!qstrcmp(tokenString, "NOTIFY")) { signalName = file->textOf(it->value->expression); generateFlags |= GenerateSignal; } } - QString storageName = QString("m_%1").arg(propertyName); + const QString storageName = QLatin1String("m_") + propertyName; generateFlags |= GenerateStorage; Class *c = klass->symbol; @@ -154,7 +156,8 @@ void InsertQtPropertyMembers::Operation::performChanges(const CppRefactoringFile // getter declaration if (m_generateFlags & GenerateGetter) { // const QString getterDeclaration = QString("%1 %2() const;").arg(typeName, getterName); - const QString getterDeclaration = QString("%1 %2() const\n{\nreturn %3;\n}\n").arg(typeName, m_getterName, m_storageName); + const QString getterDeclaration = typeName + QLatin1Char(' ') + m_getterName + + QLatin1String("() const\n{\nreturn ") + m_storageName + QLatin1String(";\n}\n"); InsertionLocation getterLoc = locator.methodDeclarationInClass(file->fileName(), m_class, InsertionPointLocator::Public); Q_ASSERT(getterLoc.isValid()); insertAndIndent(file, &declarations, getterLoc, getterDeclaration); @@ -163,11 +166,14 @@ void InsertQtPropertyMembers::Operation::performChanges(const CppRefactoringFile // setter declaration if (m_generateFlags & GenerateSetter) { // const QString setterDeclaration = QString("void %1(%2 arg);").arg(setterName, typeName); - QString setterDeclaration = QString("void %1(%2 arg)\n{\n").arg(m_setterName, typeName); - if (!m_signalName.isEmpty()) { - setterDeclaration += QString("if (%1 != arg) {\n%1 = arg;\nemit %2(arg);\n}\n}\n").arg(m_storageName, m_signalName); + QString setterDeclaration; + QTextStream setter(&setterDeclaration); + setter << "void " << m_setterName << '(' << typeName << " arg)\n{\n"; + if (m_signalName.isEmpty()) { + setter << m_storageName << " = arg;\n}\n"; } else { - setterDeclaration += QString("%1 = arg;\n}\n").arg(m_storageName); + setter << "if (" << m_storageName << " != arg) {\n" << m_storageName + << " = arg;\nemit " << m_signalName << "(arg);\n}\n}\n"; } InsertionLocation setterLoc = locator.methodDeclarationInClass(file->fileName(), m_class, InsertionPointLocator::PublicSlot); Q_ASSERT(setterLoc.isValid()); @@ -176,7 +182,8 @@ void InsertQtPropertyMembers::Operation::performChanges(const CppRefactoringFile // signal declaration if (m_generateFlags & GenerateSignal) { - const QString declaration = QString("void %1(%2 arg);\n").arg(m_signalName, typeName); + const QString declaration = QLatin1String("void ") + m_signalName + QLatin1Char('(') + + typeName + QLatin1String(" arg);\n"); InsertionLocation loc = locator.methodDeclarationInClass(file->fileName(), m_class, InsertionPointLocator::Signals); Q_ASSERT(loc.isValid()); insertAndIndent(file, &declarations, loc, declaration); @@ -184,7 +191,8 @@ void InsertQtPropertyMembers::Operation::performChanges(const CppRefactoringFile // storage if (m_generateFlags & GenerateStorage) { - const QString storageDeclaration = QString("%1 m_%2;\n").arg(typeName, propertyName); + const QString storageDeclaration = typeName + QLatin1String(" m_") + + propertyName + QLatin1String(";\n"); InsertionLocation storageLoc = locator.methodDeclarationInClass(file->fileName(), m_class, InsertionPointLocator::Private); Q_ASSERT(storageLoc.isValid()); insertAndIndent(file, &declarations, storageLoc, storageDeclaration); diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index 403679afcf6..74649c660a1 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -169,7 +169,7 @@ void CppPlugin::initializeEditor(CPPEditorWidget *editor) { m_actionHandler->setupActions(editor); - editor->setLanguageSettingsId(CppTools::Constants::CPP_SETTINGS_ID); + editor->setLanguageSettingsId(QLatin1String(CppTools::Constants::CPP_SETTINGS_ID)); TextEditor::TextEditorSettings::instance()->initializeEditor(editor); // method combo box sorting @@ -255,7 +255,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess QAction *switchDeclarationDefinition = new QAction(tr("Switch Between Method Declaration/Definition"), this); cmd = am->registerAction(switchDeclarationDefinition, Constants::SWITCH_DECLARATION_DEFINITION, context, true); - cmd->setDefaultKeySequence(QKeySequence("Shift+F2")); + cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F2"))); connect(switchDeclarationDefinition, SIGNAL(triggered()), this, SLOT(switchDeclarationDefinition())); contextMenu->addAction(cmd); @@ -279,7 +279,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess Core::Context globalContext(Core::Constants::C_GLOBAL); Core::Command *sep = createSeparator(am, this, globalContext, Constants::SEPARATOR2); - sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT); + sep->action()->setObjectName(QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT)); contextMenu->addAction(sep); contextMenu->addAction(createSeparator(am, this, globalContext, Constants::SEPARATOR3)); @@ -289,7 +289,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess cmd = am->registerAction(m_renameSymbolUnderCursorAction, Constants::RENAME_SYMBOL_UNDER_CURSOR, context); - cmd->setDefaultKeySequence(QKeySequence("CTRL+SHIFT+R")); + cmd->setDefaultKeySequence(QKeySequence(tr("CTRL+SHIFT+R"))); connect(m_renameSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(renameSymbolUnderCursor())); cppToolsMenu->addAction(cmd); @@ -330,12 +330,12 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess void CppPlugin::readSettings() { - m_sortedOutline = Core::ICore::instance()->settings()->value("CppTools/SortedMethodOverview", false).toBool(); + m_sortedOutline = Core::ICore::instance()->settings()->value(QLatin1String("CppTools/SortedMethodOverview"), false).toBool(); } void CppPlugin::writeSettings() { - Core::ICore::instance()->settings()->setValue("CppTools/SortedMethodOverview", m_sortedOutline); + Core::ICore::instance()->settings()->setValue(QLatin1String("CppTools/SortedMethodOverview"), m_sortedOutline); } void CppPlugin::extensionsInitialized() @@ -382,7 +382,7 @@ void CppPlugin::findUsages() void CppPlugin::onTaskStarted(const QString &type) { - if (type == CppTools::Constants::TASK_INDEX) { + if (type == QLatin1String(CppTools::Constants::TASK_INDEX)) { m_renameSymbolUnderCursorAction->setEnabled(false); m_findUsagesAction->setEnabled(false); m_updateCodeModelAction->setEnabled(false); @@ -392,7 +392,7 @@ void CppPlugin::onTaskStarted(const QString &type) void CppPlugin::onAllTasksFinished(const QString &type) { - if (type == CppTools::Constants::TASK_INDEX) { + if (type == QLatin1String(CppTools::Constants::TASK_INDEX)) { m_renameSymbolUnderCursorAction->setEnabled(true); m_findUsagesAction->setEnabled(true); m_updateCodeModelAction->setEnabled(true); diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 0c683a3b479..86ec09f5815 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -189,10 +189,10 @@ private: // can't remove parentheses since that might break precedence changes.remove(currentFile->range(negation->unary_op_token)); } else if (nested) { - changes.insert(currentFile->startOf(nested), "!"); + changes.insert(currentFile->startOf(nested), QLatin1String("!")); } else { - changes.insert(currentFile->startOf(binary), "!("); - changes.insert(currentFile->endOf(binary), ")"); + changes.insert(currentFile->startOf(binary), QLatin1String("!(")); + changes.insert(currentFile->endOf(binary), QLatin1String(")")); } changes.replace(currentFile->range(binary->binary_op_token), replacement); currentFile->setChangeSet(changes); @@ -578,7 +578,7 @@ private: changes.insert(start, QLatin1String(" {")); const int end = currentFile->endOf(_statement->lastToken() - 1); - changes.insert(end, "\n}"); + changes.insert(end, QLatin1String("\n}")); currentFile->setChangeSet(changes); currentFile->appendIndentRange(Utils::ChangeSet::Range(start, end)); @@ -1285,7 +1285,7 @@ public: { CppRefactoringFilePtr file = interface->currentFile(); - if (interface->editor()->mimeType() != CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE) + if (interface->editor()->mimeType() != QLatin1String(CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE)) return noResult(); WrapStringLiteral::Type type = WrapStringLiteral::TypeNone; @@ -1322,7 +1322,7 @@ private: changes.replace(currentFile->startOf(qlatin1Call), currentFile->startOf(stringLiteral), QLatin1String("@")); changes.remove(currentFile->endOf(stringLiteral), currentFile->endOf(qlatin1Call)); } else { - changes.insert(currentFile->startOf(stringLiteral), "@"); + changes.insert(currentFile->startOf(stringLiteral), QLatin1String("@")); } currentFile->setChangeSet(changes); @@ -1604,7 +1604,8 @@ private: pos = currentFile->document()->findBlockByNumber(bestLine).position(); Utils::ChangeSet changes; - changes.insert(pos, QString("#include <%1>\n").arg(QFileInfo(best).fileName())); + changes.insert(pos, QLatin1String("#include <") + + QFileInfo(best).fileName() + QLatin1String(">\n")); currentFile->setChangeSet(changes); currentFile->apply(); } @@ -1884,7 +1885,7 @@ public: QString shortestInclude; if (fileInfo.path() == QFileInfo(doc->fileName()).path()) { - shortestInclude = QString("\"%1\"").arg(fileInfo.fileName()); + shortestInclude = QLatin1Char('"') + fileInfo.fileName() + QLatin1Char('"'); } else { foreach (const QString &includePath, includePaths) { if (!fileName.startsWith(includePath)) @@ -1893,7 +1894,7 @@ public: if (!relativePath.isEmpty() && relativePath.at(0) == QLatin1Char('/')) relativePath = relativePath.mid(1); if (shortestInclude.isEmpty() || relativePath.size() + 2 < shortestInclude.size()) - shortestInclude = QString("<%1>").arg(relativePath); + shortestInclude = QLatin1Char('<') + relativePath + QLatin1Char('>'); } } @@ -1906,7 +1907,8 @@ public: && className.size() > 2 && className.at(0) == QLatin1Char('Q') && className.at(1).isUpper()) { - results += CppQuickFixOperation::Ptr(new Operation(interface, 1, QString("<%1>").arg(className))); + const QString include = QLatin1Char('<') + className + QLatin1Char('>'); + results += CppQuickFixOperation::Ptr(new Operation(interface, 1, include)); } return results; @@ -1938,7 +1940,7 @@ private: // add include const int insertPos = file->position(lastIncludeLine + 1, 1) - 1; ChangeSet changes; - changes.insert(insertPos, QString("\n#include %1").arg(m_include)); + changes.insert(insertPos, QLatin1String("\n#include ") + m_include); file->setChangeSet(changes); file->apply(); }