From a455927d4a163de62fceb4600a5403c027f74144 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 11 Jun 2020 23:09:13 +0200 Subject: [PATCH] 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] --- src/Gui/Command.cpp | 4 ++++ src/Mod/TechDraw/Gui/QGVPage.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index c6c139757d..32720506d7 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -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' diff --git a/src/Mod/TechDraw/Gui/QGVPage.cpp b/src/Mod/TechDraw/Gui/QGVPage.cpp index 15fe50760d..822a81230e 100644 --- a/src/Mod/TechDraw/Gui/QGVPage.cpp +++ b/src/Mod/TechDraw/Gui/QGVPage.cpp @@ -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()) {