Commit 158ab331 authored by Montel Laurent's avatar Montel Laurent Committed by Laurent Montel

Use QString::*Ref method

Change-Id: I63a10f274dd17e08b5b8a2577762cc9f7960b5af
Reviewed-by: default avatarhjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 384d141a
......@@ -124,7 +124,7 @@ bool QStringParser::Parser::scan(double *d, int *index)
++(*index);
}
bool ok = false;
*d = m_source.mid(startIndex, *index - startIndex).toDouble(&ok);
*d = m_source.midRef(startIndex, *index - startIndex).toDouble(&ok);
return ok;
}
......
......@@ -83,8 +83,7 @@ QColor QmlJS::toQColor(const QString &qmlColorString)
bool ok;
const int alpha = qmlColorString.midRef(1, 2).toInt(&ok, 16);
if (ok) {
QString name(qmlColorString.at(0));
name.append(qmlColorString.right(6));
const QString name = qmlColorString.at(0) + qmlColorString.rightRef(6);
if (QColor::isValidColor(name)) {
color.setNamedColor(name);
color.setAlpha(alpha);
......
......@@ -123,7 +123,7 @@ bool MimeGlobPattern::matchFileName(const QString &inputFilename) const
if (starCount == 1 && m_pattern.at(pattern_len - 1) == QLatin1Char('*')) {
if (len + 1 < pattern_len) return false;
if (m_pattern.at(0) == QLatin1Char('*'))
return filename.indexOf(m_pattern.mid(1, pattern_len - 2)) != -1;
return filename.indexOf(m_pattern.midRef(1, pattern_len - 2)) != -1;
const QChar *c1 = m_pattern.unicode();
const QChar *c2 = filename.unicode();
......
......@@ -348,7 +348,7 @@ static QStringList splitArgsUnix(const QString &args, bool abortOnMeta,
goto quoteerr;
c = args.unicode()[pos++];
} while (c != QLatin1Char('\''));
cret += args.mid(spos, pos-spos-1);
cret += args.midRef(spos, pos - spos - 1);
hadWord = true;
} else if (c == QLatin1Char('"')) {
for (;;) {
......
......@@ -144,7 +144,7 @@ void PasteBinDotComProtocol::fetch(const QString &id)
QString link = QLatin1String(PASTEBIN_BASE) + QLatin1String(PASTEBIN_RAW);
if (id.startsWith(QLatin1String("http://")))
link.append(id.mid(id.lastIndexOf(QLatin1Char('/')) + 1));
link.append(id.midRef(id.lastIndexOf(QLatin1Char('/')) + 1));
else
link.append(id);
......
......@@ -306,7 +306,7 @@ QList<Diff> Differ::moveWhitespaceIntoEqualities(const QList<Diff> &input)
}
if (j > 0) {
// diff starts with j whitespaces, move them to the previous diff
previousDiff.text.append(diff.text.left(j));
previousDiff.text.append(diff.text.leftRef(j));
diff.text = diff.text.mid(j);
}
}
......
......@@ -246,7 +246,7 @@ QString SideDiffEditorWidget::plainTextFromSelection(const QTextCursor &cursor)
if (textInserted)
text += QLatin1Char('\n');
if (block == endBlock)
text += block.text().left(endPosition - block.position());
text += block.text().leftRef(endPosition - block.position());
else
text += block.text();
}
......
......@@ -3280,7 +3280,7 @@ QString TextEditorWidgetPrivate::copyBlockSelection()
selection += QString(-startOffset, QLatin1Char(' '));
if (endOffset < 0)
--endPos;
selection += text.mid(startPos, endPos - startPos);
selection += text.midRef(startPos, endPos - startPos);
if (endOffset < 0)
selection += QString(ts.m_tabSize + endOffset, QLatin1Char(' '));
else if (endOffset > 0)
......@@ -4187,10 +4187,10 @@ void TextEditorWidget::paintEvent(QPaintEvent *e)
if (right.endsWith(QLatin1Char(';'))) {
right.chop(1);
right = right.trimmed();
replacement.append(right.right(right.endsWith(QLatin1Char('/')) ? 2 : 1));
replacement.append(right.rightRef(right.endsWith('/') ? 2 : 1));
replacement.append(QLatin1Char(';'));
} else {
replacement.append(right.right(right.endsWith(QLatin1Char('/')) ? 2 : 1));
replacement.append(right.rightRef(right.endsWith('/') ? 2 : 1));
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment