Avoid more uses of non-explicit QChar(int) constructor

Will be gone in Qt6.

Task-number: QTCREATORBUG-24098
Change-Id: Id76b15bb11879b2e8ff0f71af45acbfb1720f763
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2020-11-06 11:53:41 +01:00
parent 8edae33b42
commit eb45b8f9b9
5 changed files with 14 additions and 12 deletions

View File

@@ -986,7 +986,7 @@ int Lexer::scanString(ScanStringMode mode)
_tokenText += QChar(QChar::highSurrogate(codePoint));
u = QChar::lowSurrogate(codePoint);
} else {
u = codePoint;
u = QChar(codePoint);
}
} break;

View File

@@ -61,6 +61,11 @@
using namespace Core;
namespace BinEditor {
namespace Internal {
const QChar MidpointChar = QLatin1Char(0xB7);
static QByteArray calculateHexPattern(const QByteArray &pattern)
{
QByteArray result;
@@ -78,9 +83,6 @@ static QByteArray calculateHexPattern(const QByteArray &pattern)
return result;
}
namespace BinEditor {
namespace Internal {
class BinEditorWidgetPrivate : public EditorService
{
public:
@@ -567,7 +569,7 @@ Utils::optional<qint64> BinEditorWidget::posAt(const QPoint &pos, bool includeEm
break;
QChar qc(QLatin1Char(dataAt(dataPos)));
if (!qc.isPrint())
qc = 0xB7;
qc = MidpointChar;
x -= fontMetrics().horizontalAdvance(qc);
if (x <= 0)
break;
@@ -863,7 +865,7 @@ void BinEditorWidget::paintEvent(QPaintEvent *e)
break;
QChar qc(QLatin1Char(dataAt(pos, isOld)));
if (qc.unicode() >= 127 || !qc.isPrint())
qc = 0xB7;
qc = MidpointChar;
printable += qc;
}
} else {

View File

@@ -84,7 +84,7 @@ void StringInputStream::appendInt(IntType i)
if (hexPrefix)
pad -= 2;
if (pad > 0)
m_target.append(QString('0', pad));
m_target.append(QString('0', QLatin1Char(pad)));
}
m_target.append(n);
}

View File

@@ -308,9 +308,9 @@ QString GdbMi::escapeCString(const QString &ba)
default:
if (c < 32 || c == 127) {
ret += '\\';
ret += ('0' + (c >> 6));
ret += ('0' + ((c >> 3) & 7));
ret += ('0' + (c & 7));
ret += QLatin1Char('0' + (c >> 6));
ret += QLatin1Char('0' + ((c >> 3) & 7));
ret += QLatin1Char('0' + (c & 7));
} else {
ret += c;
}
@@ -521,7 +521,7 @@ static QString quoteUnprintableLatin1(const QString &ba)
for (int i = 0, n = ba.size(); i != n; ++i) {
const unsigned char c = ba.at(i).unicode();
if (isprint(c)) {
res += c;
res += ba.at(i);
} else {
qsnprintf(buf, sizeof(buf) - 1, "\\%x", int(c));
res += QLatin1String(buf);

View File

@@ -1189,7 +1189,7 @@ public:
return '\n';
if (m_key == Key_Escape)
return QChar(27);
return m_xkey;
return QChar(m_xkey);
}
QString toString() const