r23508 by jghali - Fix Qt deprecation warnings related to QFontMetrics::width()
scribus-commit
scribus-commit at lists.scribus.net
Sun Mar 15 22:47:31 UTC 2020
Author: jghali
Date: Sun Mar 15 22:47:31 2020
New Revision: 23508
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23508
Log:
Fix Qt deprecation warnings related to QFontMetrics::width()
Modified:
trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
trunk/Scribus/scribus/sclistboxpixmap.h
trunk/Scribus/scribus/ui/fontcombo.cpp
Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23508&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp Sun Mar 15 22:47:31 2020
@@ -1870,7 +1870,7 @@
SvgStyle *gc = m_gc.top();
QFont textFont = getFontFromStyle(*gc);
QFontMetrics fm(textFont);
- double width = fm.width(textString);
+ double width = fm.horizontalAdvance(textString);
if (gc->textAnchor == "middle")
startX -= chunkW / 2.0;
@@ -2123,7 +2123,7 @@
textFont.setPointSizeF(100.0);
QFontMetrics fm(textFont);
- width += fm.width(textString) * (fontSize / 100.0);
+ width += fm.horizontalAdvance(textString) * (fontSize / 100.0);
}
}
}
Modified: trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23508&path=/trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp Sun Mar 15 22:47:31 2020
@@ -1194,7 +1194,7 @@
textString = QString::fromLocal8Bit(textArray.data());
QFontMetrics fm( m_context.font() );
- int width = fm.width(textString) + fm.descent(); // because fm.width(text) isn't rigth with Italic text
+ int width = fm.horizontalAdvance(textString) + fm.descent(); // because fm.width(text) isn't rigth with Italic text
/*int height = fm.height();
int ascent = fm.ascent();*/
Modified: trunk/Scribus/scribus/sclistboxpixmap.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23508&path=/trunk/Scribus/scribus/sclistboxpixmap.h
==============================================================================
--- trunk/Scribus/scribus/sclistboxpixmap.h (original)
+++ trunk/Scribus/scribus/sclistboxpixmap.h Sun Mar 15 22:47:31 2020
@@ -67,8 +67,7 @@
else
{
h = qMax(pmap->height(), metrics.lineSpacing() + 2);
- //FIXME: metrics.width replacement by horizontalAdvance requires Qt 5.11+
- w = pmap->width() + metrics.width(textData) + 6;
+ w = pmap->width() + metrics.horizontalAdvance(textData) + 6;
}
QSize globalStrut = QApplication::globalStrut();
Modified: trunk/Scribus/scribus/ui/fontcombo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23508&path=/trunk/Scribus/scribus/ui/fontcombo.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/fontcombo.cpp (original)
+++ trunk/Scribus/scribus/ui/fontcombo.cpp Sun Mar 15 22:47:31 2020
@@ -655,7 +655,7 @@
QFont font(option.font);
font.setPointSize(QFontInfo(font).pointSize() * 3/2);
QFontMetrics fontMetrics(font);
- return QSize(fontMetrics.width(text), fontMetrics.height() + 5);
+ return QSize(fontMetrics.horizontalAdvance(text), fontMetrics.height() + 5);
}
More information about the scribus-commit
mailing list