forked from qt-creator/qt-creator
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:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user