From 7c9c195235378c2619d140bccbb957ba1d7a7dea Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Tue, 12 Apr 2022 17:33:01 +0200 Subject: Plugins: stop using QLatin1Char constructor for creating char literals Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: Id76add7e86b6dfb89f758a9efb0644067f0f44de Reviewed-by: Marc Mutz --- src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp | 2 +- src/plugins/platformthemes/gtk3/qgtk3menu.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/plugins/platformthemes/gtk3') diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp index 9d22f0b701..9ffd5fd496 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp @@ -521,7 +521,7 @@ void QGtk3FileDialogHelper::setNameFilters(const QStringList &filters) foreach (const QString &filter, filters) { GtkFileFilter *gtkFilter = gtk_file_filter_new(); - const QString name = filter.left(filter.indexOf(QLatin1Char('('))); + const QString name = filter.left(filter.indexOf(u'(')); const QStringList extensions = cleanFilterList(filter); gtk_file_filter_set_name(gtkFilter, qUtf8Printable(name.isEmpty() ? extensions.join(QLatin1String(", ")) : name)); diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp index 8726708917..50eb790340 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp @@ -158,23 +158,23 @@ static QString convertMnemonics(QString text, bool *found) { *found = false; - int i = text.length() - 1; + qsizetype i = text.length() - 1; while (i >= 0) { const QChar c = text.at(i); - if (c == QLatin1Char('&')) { - if (i == 0 || text.at(i - 1) != QLatin1Char('&')) { + if (c == u'&') { + if (i == 0 || text.at(i - 1) != u'&') { // convert Qt to GTK mnemonic if (i < text.length() - 1 && !text.at(i + 1).isSpace()) { - text.replace(i, 1, QLatin1Char('_')); + text.replace(i, 1, u'_'); *found = true; } - } else if (text.at(i - 1) == QLatin1Char('&')) { + } else if (text.at(i - 1) == u'&') { // unescape ampersand - text.replace(--i, 2, QLatin1Char('&')); + text.replace(--i, 2, u'&'); } - } else if (c == QLatin1Char('_')) { + } else if (c == u'_') { // escape GTK mnemonic - text.insert(i, QLatin1Char('_')); + text.insert(i, u'_'); } --i; } -- cgit v1.2.3