QTimer: avoid needless allocation

It was introduced in 4368179c37

Use QBAV to trim operation and then make QBA

Change-Id: I578305e5b5254c66052d8a11815aaa7209e629bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Anton Kudryavtsev 2023-08-23 11:18:08 +03:00 committed by Anton Kudryavtsev
parent f9dccd05d3
commit e1d00dce31

View File

@ -441,8 +441,9 @@ void QTimer::singleShot(int msec, Qt::TimerType timerType, const QObject *receiv
qWarning("QTimer::singleShot: Invalid slot specification");
return;
}
QByteArray methodName(member+1, bracketPosition - 1 - member); // extract method name
QMetaObject::invokeMethod(const_cast<QObject *>(receiver), methodName.trimmed().constData(),
const auto methodName = QByteArrayView(member + 1, // extract method name
bracketPosition - 1 - member).trimmed();
QMetaObject::invokeMethod(const_cast<QObject *>(receiver), methodName.toByteArray().constData(),
Qt::QueuedConnection);
return;
}