mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-31 03:50:20 -07:00
Replace obsoleted QFontMetrics::width()
Qt 5.13 marked QFontMetrics::width() obsolete.
This commit is contained in:
parent
c0557c296a
commit
4eff268095
3 changed files with 30 additions and 0 deletions
|
@ -302,8 +302,13 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||
|
||||
int yAxisWidth = 0;
|
||||
for (const QString &label : speedLabels)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
if (fontMetrics.horizontalAdvance(label) > yAxisWidth)
|
||||
yAxisWidth = fontMetrics.horizontalAdvance(label);
|
||||
#else
|
||||
if (fontMetrics.width(label) > yAxisWidth)
|
||||
yAxisWidth = fontMetrics.width(label);
|
||||
#endif
|
||||
|
||||
int i = 0;
|
||||
for (const QString &label : speedLabels) {
|
||||
|
@ -370,8 +375,13 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||
if (!property.enable)
|
||||
continue;
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
if (fontMetrics.horizontalAdvance(property.name) > legendWidth)
|
||||
legendWidth = fontMetrics.horizontalAdvance(property.name);
|
||||
#else
|
||||
if (fontMetrics.width(property.name) > legendWidth)
|
||||
legendWidth = fontMetrics.width(property.name);
|
||||
#endif
|
||||
legendHeight += 1.5 * fontMetrics.height();
|
||||
}
|
||||
|
||||
|
@ -385,7 +395,11 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||
if (!property.enable)
|
||||
continue;
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
int nameSize = fontMetrics.horizontalAdvance(property.name);
|
||||
#else
|
||||
int nameSize = fontMetrics.width(property.name);
|
||||
#endif
|
||||
double indent = 1.5 * (i++) * fontMetrics.height();
|
||||
|
||||
painter.setPen(property.pen);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue