From 63b042fb219a42194485e152acf6d305e4594c5c Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Mon, 25 Apr 2022 14:10:21 +0200 Subject: QtWidgets: 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: I133b80334b66e0a5ab9546dd8e1ff0631e79601e Reviewed-by: Volker Hilsheimer --- src/widgets/accessible/qaccessiblewidget.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/widgets/accessible/qaccessiblewidget.cpp') diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index ae545a5ce2..1a8d2febec 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -112,18 +112,18 @@ static QString buddyString(const QWidget *widget) /* This function will return the offset of the '&' in the text that would be preceding the accelerator character. If this text does not have an accelerator, -1 will be returned. */ -static int qt_accAmpIndex(const QString &text) +static qsizetype qt_accAmpIndex(const QString &text) { #ifndef QT_NO_SHORTCUT if (text.isEmpty()) return -1; - int fa = 0; - while ((fa = text.indexOf(QLatin1Char('&'), fa)) != -1) { + qsizetype fa = 0; + while ((fa = text.indexOf(u'&', fa)) != -1) { ++fa; if (fa < text.length()) { // ignore "&&" - if (text.at(fa) == QLatin1Char('&')) { + if (text.at(fa) == u'&') { ++fa; continue; @@ -144,7 +144,7 @@ static int qt_accAmpIndex(const QString &text) QString qt_accStripAmp(const QString &text) { QString newText(text); - int ampIndex = qt_accAmpIndex(newText); + qsizetype ampIndex = qt_accAmpIndex(newText); if (ampIndex != -1) newText.remove(ampIndex, 1); @@ -154,7 +154,7 @@ QString qt_accStripAmp(const QString &text) QString qt_accHotKey(const QString &text) { #ifndef QT_NO_SHORTCUT - int ampIndex = qt_accAmpIndex(text); + qsizetype ampIndex = qt_accAmpIndex(text); if (ampIndex != -1) return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + text.at(ampIndex + 1); #else -- cgit v1.2.3