Replace uses of QString::sprintf()

There are patches appearing on gerrit for Qt 6 to remove the functions.

Change-Id: Ic189c0a19ddc0f84eb34a56c0861532303de5129
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2019-06-20 10:16:34 +02:00
parent 4b886e12dd
commit 0ec860009a
4 changed files with 8 additions and 16 deletions

View File

@@ -1510,8 +1510,7 @@ void ConvertNumericLiteral::match(const CppQuickFixInterface &interface, QuickFi
0x20
*/
QString replacement;
replacement.sprintf("0x%lX", value);
const QString replacement = QString::asprintf("0x%lX", value);
auto op = new ConvertNumericLiteralOp(interface, start, start + numberLength, replacement);
op->setDescription(QApplication::translate("CppTools::QuickFix", "Convert to Hexadecimal"));
op->setPriority(priority);
@@ -1528,8 +1527,7 @@ void ConvertNumericLiteral::match(const CppQuickFixInterface &interface, QuickFi
With
040
*/
QString replacement;
replacement.sprintf("0%lo", value);
const QString replacement = QString::asprintf("0%lo", value);
auto op = new ConvertNumericLiteralOp(interface, start, start + numberLength, replacement);
op->setDescription(QApplication::translate("CppTools::QuickFix", "Convert to Octal"));
op->setPriority(priority);
@@ -1546,8 +1544,7 @@ void ConvertNumericLiteral::match(const CppQuickFixInterface &interface, QuickFi
With
32
*/
QString replacement;
replacement.sprintf("%lu", value);
const QString replacement = QString::asprintf("%lu", value);
auto op = new ConvertNumericLiteralOp(interface, start, start + numberLength, replacement);
op->setDescription(QApplication::translate("CppTools::QuickFix", "Convert to Decimal"));
op->setPriority(priority);