Qt5: Replace deprecated functions of QString:

'QString& QString::vsprintf(const char*, __va_list_tag*)' is deprecated: Use vasprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
'QString& QString::sprintf(const char*, ...)' is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
This commit is contained in:
wmayer
2020-06-11 23:09:13 +02:00
committed by wwmayer
parent aefd5e2358
commit a455927d4a
2 changed files with 9 additions and 0 deletions

View File

@@ -624,7 +624,11 @@ void Command::_doCommand(const char *file, int line, DoCmd_Type eType, const cha
va_list ap;
va_start(ap, sCmd);
QString s;
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
const QString cmd = s.vsprintf(sCmd, ap);
#else
const QString cmd = s.vasprintf(sCmd, ap);
#endif
va_end(ap);
// 'vsprintf' expects a utf-8 string for '%s'

View File

@@ -923,8 +923,13 @@ void QGVPage::postProcessXml(QTemporaryFile& temporaryFile, QString fileName, QS
QString::fromUtf8("stroke: none;"));
// Scale the template group correctly
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
templateGroup.setAttribute(QString::fromUtf8("transform"),
QString().sprintf("scale(%f, %f)", Rez::guiX(1.0), Rez::guiX(1.0)));
#else
templateGroup.setAttribute(QString::fromUtf8("transform"),
QString::fromLatin1("scale(%1, %2)").arg(Rez::guiX(1.0), 0, 'f').arg(Rez::guiX(1.0), 0, 'f'));
#endif
// Finally, transfer all template document child nodes under the template group
while (!templateDocElem.firstChild().isNull()) {