QtWidgets: fix a few more int/char -> QChar conversions
They were masked by all QChar ctors being made explicit, except the char16_t one, which was left as the only viable choice. Change-Id: I210d50dc243391ad2c7dd353ba9ae40147585d04 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>bb10
parent
8c43aa777e
commit
73f196644c
|
|
@ -852,12 +852,12 @@ QString QAccessibleTextWidget::attributes(int offset, int *startOffset, int *end
|
|||
AttributeFormatter attrs;
|
||||
QString family = charFormatFont.family();
|
||||
if (!family.isEmpty()) {
|
||||
family = family.replace('\\', QLatin1String("\\\\"));
|
||||
family = family.replace(':', QLatin1String("\\:"));
|
||||
family = family.replace(',', QLatin1String("\\,"));
|
||||
family = family.replace('=', QLatin1String("\\="));
|
||||
family = family.replace(';', QLatin1String("\\;"));
|
||||
family = family.replace('\"', QLatin1String("\\\""));
|
||||
family = family.replace(u'\\', QLatin1String("\\\\"));
|
||||
family = family.replace(u':', QLatin1String("\\:"));
|
||||
family = family.replace(u',', QLatin1String("\\,"));
|
||||
family = family.replace(u'=', QLatin1String("\\="));
|
||||
family = family.replace(u';', QLatin1String("\\;"));
|
||||
family = family.replace(u'\"', QLatin1String("\\\""));
|
||||
attrs["font-family"] = QLatin1Char('"') + family + QLatin1Char('"');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1182,7 +1182,7 @@ QString QCommonStylePrivate::toolButtonElideText(const QStyleOptionToolButton *o
|
|||
return option->text;
|
||||
|
||||
QString text = option->text;
|
||||
text.replace('\n', QChar::LineSeparator);
|
||||
text.replace(u'\n', QChar::LineSeparator);
|
||||
QTextOption textOption;
|
||||
textOption.setWrapMode(QTextOption::ManualWrap);
|
||||
textOption.setTextDirection(option->direction);
|
||||
|
|
|
|||
|
|
@ -2259,7 +2259,7 @@ void QLineEdit::changeEvent(QEvent *ev)
|
|||
{
|
||||
QStyleOptionFrame opt;
|
||||
initStyleOption(&opt);
|
||||
d->control->setPasswordCharacter(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, this));
|
||||
d->control->setPasswordCharacter(char16_t(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, this)));
|
||||
d->control->setPasswordMaskDelay(style()->styleHint(QStyle::SH_LineEdit_PasswordMaskDelay, &opt, this));
|
||||
}
|
||||
update();
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ void QLineEditPrivate::init(const QString& txt)
|
|||
|
||||
QStyleOptionFrame opt;
|
||||
q->initStyleOption(&opt);
|
||||
control->setPasswordCharacter(q->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, q));
|
||||
control->setPasswordCharacter(char16_t(q->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, q)));
|
||||
control->setPasswordMaskDelay(q->style()->styleHint(QStyle::SH_LineEdit_PasswordMaskDelay, &opt, q));
|
||||
#ifndef QT_NO_CURSOR
|
||||
q->setCursor(Qt::IBeamCursor);
|
||||
|
|
|
|||
|
|
@ -804,7 +804,7 @@ void QWidgetLineControl::addCommand(const Command &cmd)
|
|||
m_history.erase(m_history.begin() + m_undoState, m_history.end());
|
||||
|
||||
if (m_separator && m_undoState && m_history[m_undoState - 1].type != Separator)
|
||||
m_history.push_back(Command(Separator, m_cursor, 0, m_selstart, m_selend));
|
||||
m_history.push_back(Command(Separator, m_cursor, u'\0', m_selstart, m_selend));
|
||||
|
||||
m_separator = false;
|
||||
m_history.push_back(cmd);
|
||||
|
|
@ -836,7 +836,7 @@ void QWidgetLineControl::internalInsert(const QString &s)
|
|||
m_passwordEchoTimer = startTimer(delay);
|
||||
}
|
||||
if (hasSelectedText())
|
||||
addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
|
||||
addCommand(Command(SetSelection, m_cursor, u'\0', m_selstart, m_selend));
|
||||
if (m_maskData) {
|
||||
QString ms = maskString(m_cursor, s);
|
||||
if (ms.isEmpty() && !s.isEmpty())
|
||||
|
|
@ -890,7 +890,7 @@ void QWidgetLineControl::internalDelete(bool wasBackspace)
|
|||
if (m_cursor < (int) m_text.length()) {
|
||||
cancelPasswordEchoTimer();
|
||||
if (hasSelectedText())
|
||||
addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
|
||||
addCommand(Command(SetSelection, m_cursor, u'\0', m_selstart, m_selend));
|
||||
addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)),
|
||||
m_cursor, m_text.at(m_cursor), -1, -1));
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
|
@ -922,7 +922,7 @@ void QWidgetLineControl::removeSelectedText()
|
|||
cancelPasswordEchoTimer();
|
||||
separate();
|
||||
int i ;
|
||||
addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
|
||||
addCommand(Command(SetSelection, m_cursor, u'\0', m_selstart, m_selend));
|
||||
if (m_selstart <= m_cursor && m_cursor < m_selend) {
|
||||
// cursor is within the selection. Split up the commands
|
||||
// to be able to restore the correct cursor position
|
||||
|
|
@ -981,17 +981,16 @@ void QWidgetLineControl::parseInputMask(const QString &maskFields)
|
|||
|
||||
// calculate m_maxLength / m_maskData length
|
||||
m_maxLength = 0;
|
||||
QChar c = 0;
|
||||
bool escaped = false;
|
||||
for (int i=0; i<m_inputMask.length(); i++) {
|
||||
c = m_inputMask.at(i);
|
||||
const auto c = m_inputMask.at(i);
|
||||
if (escaped) {
|
||||
++m_maxLength;
|
||||
escaped = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '\\') {
|
||||
if (c == u'\\') {
|
||||
escaped = true;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1007,12 +1006,11 @@ void QWidgetLineControl::parseInputMask(const QString &maskFields)
|
|||
m_maskData = new MaskInputData[m_maxLength];
|
||||
|
||||
MaskInputData::Casemode m = MaskInputData::NoCaseMode;
|
||||
c = 0;
|
||||
bool s;
|
||||
bool escape = false;
|
||||
int index = 0;
|
||||
for (int i = 0; i < m_inputMask.length(); i++) {
|
||||
c = m_inputMask.at(i);
|
||||
const auto c = m_inputMask.at(i);
|
||||
if (escape) {
|
||||
s = true;
|
||||
m_maskData[index].maskChar = c;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ public:
|
|||
// password data to stay in the process memory, therefore we need
|
||||
// to zero it out
|
||||
if (m_echoMode != QLineEdit::Normal)
|
||||
m_text.fill('\0');
|
||||
m_text.fill(u'\0');
|
||||
|
||||
delete [] m_maskData;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue