Use QStringRef instead of QString whenever possible.
That way we reduce count of temporary QString instances. Change-Id: Id806c68ea616828c2355c07b8576616fa6a8da17 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
15025088ea
commit
e485e066ac
@@ -508,7 +508,7 @@ QString CameraBinSession::generateFileName(const QString &prefix, const QDir &di
|
||||
{
|
||||
int lastClip = 0;
|
||||
foreach(QString fileName, dir.entryList(QStringList() << QString("%1*.%2").arg(prefix).arg(ext))) {
|
||||
int imgNumber = fileName.mid(prefix.length(), fileName.size()-prefix.length()-ext.length()-1).toInt();
|
||||
int imgNumber = fileName.midRef(prefix.length(), fileName.size()-prefix.length()-ext.length()-1).toInt();
|
||||
lastClip = qMax(lastClip, imgNumber);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ int QGstreamerImageCaptureControl::capture(const QString &fileName)
|
||||
int lastImage = 0;
|
||||
QDir outputDir = QDir::currentPath();
|
||||
foreach(QString fileName, outputDir.entryList(QStringList() << "img_*.jpg")) {
|
||||
int imgNumber = fileName.mid(4, fileName.size()-8).toInt();
|
||||
int imgNumber = fileName.midRef(4, fileName.size()-8).toInt();
|
||||
lastImage = qMax(lastImage, imgNumber);
|
||||
}
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ QString QGstreamerRecorderControl::generateFileName(const QDir &dir, const QStri
|
||||
|
||||
int lastClip = 0;
|
||||
foreach(QString fileName, dir.entryList(QStringList() << QString("clip_*.%1").arg(ext))) {
|
||||
int imgNumber = fileName.mid(5, fileName.size()-6-ext.length()).toInt();
|
||||
int imgNumber = fileName.midRef(5, fileName.size()-6-ext.length()).toInt();
|
||||
lastClip = qMax(lastClip, imgNumber);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user