Commit 1d531104 authored by Andre Hartmann's avatar Andre Hartmann Committed by André Hartmann

Designer: Modernize

* Remove QLatin1{Char|String}
* Use member initialization
* Use range-for
* Use nullptr

Change-Id: I51c24c0a2066861f59731585f19d61b28c76c0a3
Reviewed-by: default avatarhjk <hjk@qt.io>
Reviewed-by: Friedemann Kleint's avatarFriedemann Kleint <Friedemann.Kleint@qt.io>
parent 72c283af
......@@ -129,7 +129,7 @@ bool navigateToSlot(const QString &uiFileName,
SearchFunction searchFunc(setupUiC);
const SearchFunction::FunctionList funcs = searchFunc(generatedHeaderDoc);
if (funcs.size() != 1) {
*errorMessage = QString::fromLatin1("Internal error: The function \"%1\" could not be found in %2").arg(QLatin1String(setupUiC), generatedHeaderFile);
*errorMessage = QString::fromLatin1("Internal error: The function \"%1\" could not be found in %2").arg(setupUiC, generatedHeaderFile);
return false;
}
return true;
......
......@@ -43,17 +43,17 @@ FormClassWizard::FormClassWizard()
QString FormClassWizard::headerSuffix() const
{
return preferredSuffix(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE));
return preferredSuffix(CppTools::Constants::CPP_HEADER_MIMETYPE);
}
QString FormClassWizard::sourceSuffix() const
{
return preferredSuffix(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE));
return preferredSuffix(CppTools::Constants::CPP_SOURCE_MIMETYPE);
}
QString FormClassWizard::formSuffix() const
{
return preferredSuffix(QLatin1String(Constants::FORM_MIMETYPE));
return preferredSuffix(Constants::FORM_MIMETYPE);
}
Core::BaseFileWizard *FormClassWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
......@@ -69,7 +69,7 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e
const Designer::FormClassWizardParameters params = wizardDialog->parameters();
if (params.uiTemplate.isEmpty()) {
*errorMessage = QLatin1String("Internal error: FormClassWizard::generateFiles: empty template contents");
*errorMessage = "Internal error: FormClassWizard::generateFiles: empty template contents";
return Core::GeneratedFiles();
}
......
......@@ -46,7 +46,8 @@ FormClassWizardDialog::FormClassWizardDialog(const Core::BaseFileWizardFactory *
setPage(FormPageId, m_formPage);
setPage(ClassPageId, m_classPage);
foreach (QWizardPage *p, extensionPages())
const auto pages = extensionPages();
for (QWizardPage *p : pages)
addPage(p);
}
......
......@@ -43,7 +43,7 @@ class FormClassWizardDialog : public Core::BaseFileWizard
public:
typedef QList<QWizardPage *> WizardPageList;
explicit FormClassWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = 0);
explicit FormClassWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = nullptr);
QString path() const;
void setPath(const QString &);
......@@ -56,8 +56,8 @@ protected:
void initializePage(int id);
private:
FormTemplateWizardPage *m_formPage;
FormClassWizardPage *m_classPage;
FormTemplateWizardPage *m_formPage = nullptr;
FormClassWizardPage *m_classPage = nullptr;
QString m_rawFormTemplate;
};
......
......@@ -44,8 +44,7 @@ namespace Internal {
FormClassWizardPage::FormClassWizardPage(QWidget * parent) :
QWizardPage(parent),
m_ui(new Ui::FormClassWizardPage),
m_isValid(false)
m_ui(new Ui::FormClassWizardPage)
{
m_ui->setupUi(this);
......@@ -69,9 +68,9 @@ FormClassWizardPage::~FormClassWizardPage()
// Retrieve settings of CppTools plugin.
bool FormClassWizardPage::lowercaseHeaderFiles()
{
QString lowerCaseSettingsKey = QLatin1String(CppTools::Constants::CPPTOOLS_SETTINGSGROUP);
lowerCaseSettingsKey += QLatin1Char('/');
lowerCaseSettingsKey += QLatin1String(CppTools::Constants::LOWERCASE_CPPFILES_KEY);
QString lowerCaseSettingsKey = CppTools::Constants::CPPTOOLS_SETTINGSGROUP;
lowerCaseSettingsKey += '/';
lowerCaseSettingsKey += CppTools::Constants::LOWERCASE_CPPFILES_KEY;
const bool lowerCaseDefault = CppTools::Constants::lowerCaseFilesDefault;
return Core::ICore::settings()->value(lowerCaseSettingsKey, QVariant(lowerCaseDefault)).toBool();
}
......
......@@ -42,7 +42,7 @@ class FormClassWizardPage : public QWizardPage
Q_OBJECT
public:
explicit FormClassWizardPage(QWidget * parent = 0);
explicit FormClassWizardPage(QWidget *parent = nullptr);
~FormClassWizardPage();
virtual bool isComplete () const;
......@@ -66,8 +66,8 @@ private:
private:
void initFileGenerationSettings();
Ui::FormClassWizardPage *m_ui;
bool m_isValid;
Ui::FormClassWizardPage *m_ui = nullptr;
bool m_isValid = false;
};
} // namespace Internal
......
......@@ -35,7 +35,7 @@ class DesignerContext : public Core::IContext
public:
explicit DesignerContext(const Core::Context &contexts,
QWidget *widget,
QObject *parent = 0);
QObject *parent = nullptr);
QString contextHelpId() const override;
};
......
......@@ -43,7 +43,7 @@ EditorWidget::EditorWidget(QWidget *parent) :
Utils::FancyMainWindow(parent),
m_stack(new FormEditorStack)
{
setObjectName(QLatin1String("EditorWidget"));
setObjectName("EditorWidget");
setCentralWidget(m_stack);
setDocumentMode(true);
setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::South);
......@@ -69,8 +69,8 @@ EditorWidget::EditorWidget(QWidget *parent) :
void EditorWidget::resetToDefaultLayout()
{
setTrackingEnabled(false);
QList<QDockWidget *> dockWidgetList = dockWidgets();
foreach (QDockWidget *dockWidget, dockWidgetList) {
const QList<QDockWidget *> dockWidgetList = dockWidgets();
for (QDockWidget *dockWidget : dockWidgetList) {
dockWidget->setFloating(false);
removeDockWidget(dockWidget);
}
......@@ -84,7 +84,7 @@ void EditorWidget::resetToDefaultLayout()
tabifyDockWidget(m_designerDockWidgets[ActionEditorSubWindow],
m_designerDockWidgets[SignalSlotEditorSubWindow]);
foreach (QDockWidget *dockWidget, dockWidgetList)
for (QDockWidget *dockWidget : dockWidgetList)
dockWidget->show();
setTrackingEnabled(true);
......
......@@ -51,7 +51,7 @@ class EditorWidget : public Utils::FancyMainWindow
Q_OBJECT
public:
explicit EditorWidget(QWidget *parent = 0);
explicit EditorWidget(QWidget *parent = nullptr);
QDockWidget* const* designerDockWidgets() const;
......@@ -66,7 +66,7 @@ public:
void resetToDefaultLayout();
private:
FormEditorStack *m_stack;
FormEditorStack *m_stack = nullptr;
QDockWidget *m_designerDockWidgets[Designer::Constants::DesignerSubWindowCount];
};
......
......@@ -46,6 +46,7 @@
#include <coreplugin/designmode.h>
#include <cpptools/cpptoolsconstants.h>
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
#include <utils/asconst.h>
#include <utils/mimetypes/mimedatabase.h>
#include <QAction>
......@@ -84,7 +85,7 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
IWizardFactory::registerFactoryCreator(
[]() -> QList<IWizardFactory *> {
IWizardFactory *wizard = new FormClassWizard;
wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
wizard->setCategory(Core::Constants::WIZARD_CATEGORY_QT);
wizard->setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
wizard->setDisplayName(tr("Qt Designer Form Class"));
wizard->setIconText("ui/h");
......@@ -104,10 +105,9 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
const QString locale = ICore::userInterfaceLanguage();
if (!locale.isEmpty()) {
QTranslator *qtr = new QTranslator(this);
const QString &creatorTrPath =
ICore::resourcePath() + QLatin1String("/translations");
const QString &creatorTrPath = ICore::resourcePath() + "/translations";
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &trFile = QLatin1String("designer_") + locale;
const QString &trFile = "designer_" + locale;
if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath))
QCoreApplication::installTranslator(qtr);
}
......@@ -164,19 +164,18 @@ static QString otherFile()
// Determine potential suffixes of candidate files
// 'ui' -> 'cpp', 'cpp/h' -> 'ui'.
QStringList candidateSuffixes;
if (currentMimeType.matchesName(QLatin1String(FORM_MIMETYPE))) {
if (currentMimeType.matchesName(FORM_MIMETYPE)) {
candidateSuffixes += Utils::mimeTypeForName(CppTools::Constants::CPP_SOURCE_MIMETYPE).suffixes();
} else if (currentMimeType.matchesName(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE))
|| currentMimeType.matchesName(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE))) {
} else if (currentMimeType.matchesName(CppTools::Constants::CPP_SOURCE_MIMETYPE)
|| currentMimeType.matchesName(CppTools::Constants::CPP_HEADER_MIMETYPE)) {
candidateSuffixes += Utils::mimeTypeForName(FORM_MIMETYPE).suffixes();
} else {
return QString();
}
// Try to find existing file with desired suffix
const QFileInfo currentFI(current);
const QString currentBaseName = currentFI.path() + QLatin1Char('/')
+ currentFI.baseName() + QLatin1Char('.');
foreach (const QString &candidateSuffix, candidateSuffixes) {
const QString currentBaseName = currentFI.path() + '/' + currentFI.baseName() + '.';
for (const QString &candidateSuffix : Utils::asConst(candidateSuffixes)) {
const QFileInfo fi(currentBaseName + candidateSuffix);
if (fi.isFile())
return fi.absoluteFilePath();
......
......@@ -44,7 +44,7 @@ public:
~FormEditorPlugin() override;
//Plugin
bool initialize(const QStringList &arguments, QString *errorMessage = 0) override;
bool initialize(const QStringList &arguments, QString *errorMessage = nullptr) override;
void extensionsInitialized() override;
#ifdef WITH_TESTS
......@@ -57,7 +57,7 @@ private:
void switchSourceForm();
void initializeTemplates();
QAction *m_actionSwitchSource;
QAction *m_actionSwitchSource = nullptr;
};
} // namespace Internal
......
......@@ -34,6 +34,7 @@
#include <coreplugin/modemanager.h>
#include <coreplugin/imode.h>
#include <utils/asconst.h>
#include <utils/qtcassert.h>
#include <QDesignerFormWindowInterface>
......@@ -48,10 +49,9 @@ namespace Designer {
namespace Internal {
FormEditorStack::FormEditorStack(QWidget *parent) :
QStackedWidget(parent),
m_designerCore(0)
QStackedWidget(parent)
{
setObjectName(QLatin1String("FormEditorStack"));
setObjectName("FormEditorStack");
}
void FormEditorStack::add(const EditorData &data)
......@@ -153,7 +153,7 @@ void FormEditorStack::updateFormWindowSelectionHandles()
if (Designer::Constants::Internal::debug)
qDebug() << "updateFormWindowSelectionHandles";
QDesignerFormWindowInterface *activeFormWindow = m_designerCore->formWindowManager()->activeFormWindow();
foreach (const EditorData &fdm, m_formEditors) {
for (const EditorData &fdm : Utils::asConst(m_formEditors)) {
const bool active = activeFormWindow == fdm.widgetHost->formWindow();
fdm.widgetHost->updateFormWindowSelectionHandles(active);
}
......@@ -166,7 +166,7 @@ void FormEditorStack::formSizeChanged(int w, int h)
qDebug() << Q_FUNC_INFO << w << h;
if (const SharedTools::WidgetHost *wh = qobject_cast<const SharedTools::WidgetHost *>(sender())) {
wh->formWindow()->setDirty(true);
static const QString geometry = QLatin1String("geometry");
static const QString geometry = "geometry";
m_designerCore->propertyEditor()->setPropertyValue(geometry, QRect(0,0,w,h) );
}
}
......@@ -184,7 +184,7 @@ void FormEditorStack::modeAboutToChange(Core::Id mode)
// Sync the editor when entering edit mode
if (mode == Core::Constants::MODE_EDIT)
foreach (const EditorData &data, m_formEditors)
for (const EditorData &data : Utils::asConst(m_formEditors))
data.formWindowEditor->formWindowFile()->syncXmlFromFormWindow();
}
......
......@@ -52,7 +52,7 @@ class FormEditorStack : public QStackedWidget
Q_OBJECT
public:
explicit FormEditorStack(QWidget *parent = 0);
explicit FormEditorStack(QWidget *parent = nullptr);
void add(const EditorData &d);
......@@ -73,7 +73,7 @@ private:
inline int indexOfFormEditor(const QObject *xmlEditor) const;
QList<EditorData> m_formEditors;
QDesignerFormEditorInterface *m_designerCore;
QDesignerFormEditorInterface *m_designerCore = nullptr;
};
} // namespace Internal
......
This diff is collapsed.
......@@ -49,7 +49,7 @@ namespace Internal {
FormPageFactory::FormPageFactory()
{
setTypeIdsSuffix(QLatin1String("Form"));
setTypeIdsSuffix("Form");
}
Utils::WizardPage *FormPageFactory::create(ProjectExplorer::JsonWizard *wizard, Core::Id typeId,
......@@ -117,14 +117,14 @@ bool FormTemplateWizardPage::validatePage()
QMessageBox::critical(this, tr("%1 - Error").arg(title()), errorMessage);
return false;
}
wizard()->setProperty("FormContents", m_templateContents.split(QLatin1Char('\n')));
wizard()->setProperty("FormContents", m_templateContents.split('\n'));
return true;
}
QString FormTemplateWizardPage::stripNamespaces(const QString &className)
{
QString rc = className;
const int namespaceIndex = rc.lastIndexOf(QLatin1String("::"));
const int namespaceIndex = rc.lastIndexOf("::");
if (namespaceIndex != -1)
rc.remove(0, namespaceIndex + 2);
return rc;
......
......@@ -56,7 +56,7 @@ class FormTemplateWizardPage : public Utils::WizardPage
Q_OBJECT
public:
explicit FormTemplateWizardPage(QWidget * parent = 0);
explicit FormTemplateWizardPage(QWidget *parent = nullptr);
bool isComplete () const override;
bool validatePage() override;
......@@ -72,8 +72,8 @@ private:
void slotCurrentTemplateChanged(bool);
QString m_templateContents;
QDesignerNewFormWidgetInterface *m_newFormWidget;
bool m_templateSelected;
QDesignerNewFormWidgetInterface *m_newFormWidget = nullptr;
bool m_templateSelected = false;
};
} // namespace Internal
......
......@@ -49,7 +49,7 @@ namespace Internal {
FormWindowFile::FormWindowFile(QDesignerFormWindowInterface *form, QObject *parent)
: m_formWindow(form)
{
setMimeType(QLatin1String(Designer::Constants::FORM_MIMETYPE));
setMimeType(Designer::Constants::FORM_MIMETYPE);
setParent(parent);
setId(Core::Id(Designer::Constants::K_DESIGNER_XML_EDITOR_ID));
// Designer needs UTF-8 regardless of settings.
......
......@@ -44,7 +44,7 @@ class FormWindowFile : public TextEditor::TextDocument
Q_OBJECT
public:
explicit FormWindowFile(QDesignerFormWindowInterface *form, QObject *parent = 0);
explicit FormWindowFile(QDesignerFormWindowInterface *form, QObject *parent = nullptr);
~FormWindowFile() override { }
// IDocument
......
......@@ -36,6 +36,7 @@
#include <cplusplus/CppDocument.h>
#include <cplusplus/Overview.h>
#include <utils/asconst.h>
#include <utils/fileutils.h>
#include <QDesignerFormEditorInterface>
......@@ -120,7 +121,7 @@ protected:
{
QString declaration = m_overview.prettyName(symbol->name());
if (!m_currentClass.isEmpty())
declaration = m_currentClass + QLatin1String("::") + declaration;
declaration = m_currentClass + "::" + declaration;
if (m_referenceFunction == declaration)
m_result = true;
return false;
......@@ -153,7 +154,7 @@ public:
QCOMPARE(files.size(), 3);
QList<TextEditor::BaseTextEditor *> editors;
foreach (const QString &file, files) {
for (const QString &file : files) {
IEditor *editor = EditorManager::openEditor(file);
TextEditor::BaseTextEditor *e = qobject_cast<TextEditor::BaseTextEditor *>(editor);
QVERIFY(e);
......@@ -170,14 +171,13 @@ public:
// Execute "Go To Slot"
QDesignerIntegrationInterface *integration = FormEditorW::designerEditor()->integration();
QVERIFY(integration);
integration->emitNavigateToSlot(QLatin1String("pushButton"), QLatin1String("clicked()"),
QStringList());
integration->emitNavigateToSlot("pushButton", "clicked()", QStringList());
QCOMPARE(EditorManager::currentDocument()->filePath().toString(), cppFile);
QVERIFY(EditorManager::currentDocument()->isModified());
// Wait for updated documents
foreach (TextEditor::BaseTextEditor *editor, editors) {
for (TextEditor::BaseTextEditor *editor : Utils::asConst(editors)) {
const QString filePath = editor->document()->filePath().toString();
if (auto parser = BuiltinEditorDocumentParser::get(filePath)) {
forever {
......@@ -201,10 +201,8 @@ public:
const Document::Ptr hDocument = hDocumentParser->document();
QVERIFY(checkDiagsnosticMessages(hDocument));
QVERIFY(documentContainsFunctionDefinition(cppDocument,
QLatin1String("Form::on_pushButton_clicked")));
QVERIFY(documentContainsMemberFunctionDeclaration(hDocument,
QLatin1String("Form::on_pushButton_clicked")));
QVERIFY(documentContainsFunctionDefinition(cppDocument, "Form::on_pushButton_clicked"));
QVERIFY(documentContainsMemberFunctionDeclaration(hDocument, "Form::on_pushButton_clicked"));
}
static bool checkDiagsnosticMessages(const Document::Ptr &document)
......@@ -217,7 +215,8 @@ public:
const QStringList ignoreList = QStringList({"ui_form.h: No such file or directory",
"QWidget: No such file or directory"});
QList<Document::DiagnosticMessage> cleanedDiagnosticMessages;
foreach (const Document::DiagnosticMessage &message, document->diagnosticMessages()) {
const auto diagnosticMessages = document->diagnosticMessages();
for (const Document::DiagnosticMessage &message : diagnosticMessages) {
if (!ignoreList.contains(message.text()))
cleanedDiagnosticMessages << message;
}
......
......@@ -38,7 +38,7 @@ class QtCreatorIntegration : public QDesignerIntegration
Q_OBJECT
public:
explicit QtCreatorIntegration(QDesignerFormEditorInterface *core, QObject *parent = 0);
explicit QtCreatorIntegration(QDesignerFormEditorInterface *core, QObject *parent = nullptr);
QWidget *containerWindow(QWidget *widget) const override;
......
......@@ -69,7 +69,7 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
QtSupport::CodeGenSettings generationParameters;
generationParameters.fromSettings(Core::ICore::settings());
const QString indent = QString(indentation, QLatin1Char(' '));
const QString indent = QString(indentation, ' ');
QString formBaseClass;
QString uiClassName;
......@@ -79,11 +79,11 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
}
// Build the ui class (Ui::Foo) name relative to the namespace (which is the same):
const QString colonColon = QLatin1String("::");
const QString colonColon = "::";
const int lastSeparator = uiClassName.lastIndexOf(colonColon);
if (lastSeparator != -1)
uiClassName.remove(0, lastSeparator + colonColon.size());
uiClassName.insert(0, QLatin1String(uiNamespaceC) + colonColon);
uiClassName.insert(0, uiNamespaceC + colonColon);
// Do we have namespaces?
QStringList namespaceList = parameters.className.split(colonColon);
......@@ -99,9 +99,7 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
// Include guards
const QString guard = Utils::headerGuard(parameters.headerFile, namespaceList);
QString uiInclude = QLatin1String("ui_");
uiInclude += QFileInfo(parameters.uiFile).completeBaseName();
uiInclude += QLatin1String(".h");
const QString uiInclude = "ui_" + QFileInfo(parameters.uiFile).completeBaseName() + ".h";
// 1) Header file
QTextStream headerStr(header);
......@@ -114,16 +112,16 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
} else {
// Todo: Can we obtain the header from the code model for custom widgets?
// Alternatively, from Designer.
if (formBaseClass.startsWith(QLatin1Char('Q'))) {
if (formBaseClass.startsWith('Q')) {
if (generationParameters.includeQtModule) {
if (generationParameters.addQtVersionCheck) {
Utils::writeBeginQtVersionCheck(headerStr);
Utils::writeIncludeFileDirective(QLatin1String("QtWidgets/") + formBaseClass, true, headerStr);
Utils::writeIncludeFileDirective("QtWidgets/" + formBaseClass, true, headerStr);
headerStr << "#else\n";
Utils::writeIncludeFileDirective(QLatin1String("QtGui/") + formBaseClass, true, headerStr);
Utils::writeIncludeFileDirective("QtGui/" + formBaseClass, true, headerStr);
headerStr << "#endif\n";
} else {
Utils::writeIncludeFileDirective(QLatin1String("QtGui/") + formBaseClass, true, headerStr);
Utils::writeIncludeFileDirective("QtGui/" + formBaseClass, true, headerStr);
}
} else {
Utils::writeIncludeFileDirective(formBaseClass, true, headerStr);
......
......@@ -42,7 +42,7 @@ class QtDesignerFormClassCodeGenerator : public QObject
{
Q_OBJECT
public:
explicit QtDesignerFormClassCodeGenerator(QObject *parent = 0);
explicit QtDesignerFormClassCodeGenerator(QObject *parent = nullptr);
static bool generateCpp(const FormClassWizardParameters &parameters,
QString *header, QString *source, int indentation = 4);
......
......@@ -34,6 +34,7 @@
#include <QDesignerFormWindowInterface>
#include <utils/asconst.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
......@@ -108,7 +109,7 @@ void ResourceHandler::updateResourcesHelper(bool updateProjectResources)
// Check if the user has chosen to update the lacking resource inside designer
if (dirty && updateProjectResources) {
QStringList qrcPathsToBeAdded;
foreach (const QString &originalQrcPath, m_originalUiQrcPaths) {
for (const QString &originalQrcPath : Utils::asConst(m_originalUiQrcPaths)) {
if (!projectQrcFiles.contains(originalQrcPath) && !qrcPathsToBeAdded.contains(originalQrcPath))
qrcPathsToBeAdded.append(originalQrcPath);
}
......
......@@ -59,7 +59,7 @@ private:
void ensureInitialized();
void updateResourcesHelper(bool updateProjectResources);
QDesignerFormWindowInterface * const m_form;
QDesignerFormWindowInterface * const m_form = nullptr;
QStringList m_originalUiQrcPaths;
bool m_initialized = false;
bool m_handlingResources = false;
......
......@@ -67,6 +67,6 @@ QString SettingsManager::addPrefix(const QString &name) const
{
QString result = name;
if (Core::ICore::settings()->group().isEmpty())
result.prepend(QLatin1String("Designer"));
result.prepend("Designer");
return result;
}
......@@ -28,6 +28,7 @@
#include <coreplugin/icontext.h>
#include <utils/asconst.h>
#include <utils/stringutils.h>
#include <QDesignerOptionsPageInterface>
......@@ -74,7 +75,7 @@ SettingsPageProvider::SettingsPageProvider(QObject *parent)
setCategory(Designer::Constants::SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("Designer",
Designer::Constants::SETTINGS_TR_CATEGORY));
setCategoryIcon(QLatin1String(Designer::Constants::SETTINGS_CATEGORY_ICON));
setCategoryIcon(Designer::Constants::SETTINGS_CATEGORY_ICON);
}
QList<Core::IOptionsPage *> SettingsPageProvider::pages() const
......@@ -120,7 +121,7 @@ bool SettingsPageProvider::matches(const QString &searchKeyWord) const
for (size_t i = 0; i < itemCount; ++i)
m_keywords << Utils::stripAccelerator(QCoreApplication::translate(uitext[i].context, uitext[i].value));
}
foreach (const QString &key, m_keywords) {
for (const QString &key : Utils::asConst(m_keywords)) {
if (key.contains(searchKeyWord, Qt::CaseInsensitive))
return true;
}
......
......@@ -60,7 +60,7 @@ class SettingsPageProvider : public Core::IOptionsPageProvider
Q_OBJECT
public:
SettingsPageProvider(QObject *parent = 0);
explicit SettingsPageProvider(QObject *parent = nullptr);
QList<Core::IOptionsPage *> pages() const override;
bool matches(const QString &searchKeyWord) const override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment