forked from qt-creator/qt-creator
Preferably use QStringRef::toInt().
Avoid allocations for converting to int. Change-Id: Id8c79334f4809ec075ffe7e6b7635be4873eafd8 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -108,8 +108,8 @@ void TypeDescriptionReader::readDocument(UiProgram *ast)
|
||||
const QString versionString = _source.mid(import->versionToken.offset, import->versionToken.length);
|
||||
const int dotIdx = versionString.indexOf(QLatin1Char('.'));
|
||||
if (dotIdx != -1) {
|
||||
version = ComponentVersion(versionString.left(dotIdx).toInt(),
|
||||
versionString.mid(dotIdx + 1).toInt());
|
||||
version = ComponentVersion(versionString.leftRef(dotIdx).toInt(),
|
||||
versionString.midRef(dotIdx + 1).toInt());
|
||||
}
|
||||
if (version.majorVersion() != 1) {
|
||||
addError(import->versionToken, tr("Major version different from 1 not supported."));
|
||||
|
||||
@@ -79,7 +79,7 @@ QColor QmlJS::toQColor(const QString &qmlColorString)
|
||||
QColor color;
|
||||
if (qmlColorString.size() == 9 && qmlColorString.at(0) == QLatin1Char('#')) {
|
||||
bool ok;
|
||||
const int alpha = qmlColorString.mid(1, 2).toInt(&ok, 16);
|
||||
const int alpha = qmlColorString.midRef(1, 2).toInt(&ok, 16);
|
||||
if (ok) {
|
||||
QString name(qmlColorString.at(0));
|
||||
name.append(qmlColorString.right(6));
|
||||
|
||||
Reference in New Issue
Block a user