From 0301cf567e0aec1abdd0b926849e15bebaf25a74 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 14 Sep 2021 16:38:44 +0300 Subject: [PATCH] error: 'int QFontMetrics::width(const QString&, int) const' is deprecated: Use QFontMetrics::horizontalAdvance. --- src/app/puzzle/vptilefactory.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/puzzle/vptilefactory.cpp b/src/app/puzzle/vptilefactory.cpp index 7de5e03f3..6093e13a7 100644 --- a/src/app/puzzle/vptilefactory.cpp +++ b/src/app/puzzle/vptilefactory.cpp @@ -363,8 +363,12 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet td.setPageSize(QSizeF(m_drawingAreaHeight - UnitConvertor(2, Unit::Cm, Unit::Px), m_drawingAreaWidth)); QFontMetrics metrix = QFontMetrics(td.defaultFont()); - QString clippedSheetName = metrix.elidedText(sheet->GetName(), Qt::ElideMiddle, - metrix.width(QString().fill('z', 50))); +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + int maxWidth = metrix.horizontalAdvance(QString().fill('z', 50)); +#else + int maxWidth = metrix.width(QString().fill('z', 50)); +#endif + QString clippedSheetName = metrix.elidedText(sheet->GetName(), Qt::ElideMiddle, maxWidth); td.setHtml(QString("" ""