summaryrefslogtreecommitdiffstats
path: root/examples/widgets/tools
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/tools')
-rw-r--r--examples/widgets/tools/i18n/languagechooser.cpp6
-rw-r--r--examples/widgets/tools/i18n/languagechooser.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/examples/widgets/tools/i18n/languagechooser.cpp b/examples/widgets/tools/i18n/languagechooser.cpp
index 51dfce915f..2f82fc678b 100644
--- a/examples/widgets/tools/i18n/languagechooser.cpp
+++ b/examples/widgets/tools/i18n/languagechooser.cpp
@@ -97,12 +97,12 @@ LanguageChooser::LanguageChooser(const QString &defaultLang, QWidget *parent)
setWindowTitle("I18N");
}
-bool LanguageChooser::languageMatch(const QString &lang, const QString &qmFile)
+bool LanguageChooser::languageMatch(QStringView lang, QStringView qmFile)
{
//qmFile: i18n_xx.qm
- const QString prefix = "i18n_";
+ const QStringView prefix{ u"i18n_" };
const int langTokenLength = 2; /*FIXME: is checking two chars enough?*/
- return qmFile.midRef(qmFile.indexOf(prefix) + prefix.length(), langTokenLength) == lang.leftRef(langTokenLength);
+ return qmFile.mid(qmFile.indexOf(prefix) + prefix.length(), langTokenLength) == lang.left(langTokenLength);
}
bool LanguageChooser::eventFilter(QObject *object, QEvent *event)
diff --git a/examples/widgets/tools/i18n/languagechooser.h b/examples/widgets/tools/i18n/languagechooser.h
index 733cc50fd3..6193ab8756 100644
--- a/examples/widgets/tools/i18n/languagechooser.h
+++ b/examples/widgets/tools/i18n/languagechooser.h
@@ -83,7 +83,7 @@ private:
static QStringList findQmFiles();
static QString languageName(const QString &qmFile);
static QColor colorForLanguage(const QString &language);
- static bool languageMatch(const QString &lang, const QString &qmFile);
+ static bool languageMatch(QStringView lang, QStringView qmFile);
QGroupBox *groupBox;
QDialogButtonBox *buttonBox;