Commit 084362d1 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Port away from deprecated QFontMetrics::width

parent 797fc5fd
......@@ -27,7 +27,7 @@ GuidanceLine::GuidanceLine(qreal x, qreal y, qreal text_offset)
text->setPos(text_offset, y);
QFontMetricsF fm(text->font());
qreal xe = text_offset + fm.width(ZERO);
qreal xe = text_offset + fm.horizontalAdvance(ZERO);
setLine(x, y, xe, y);
}
......@@ -42,7 +42,7 @@ void GuidanceLine::update(qreal nx, qreal ny, const QString &txt)
text->setPlainText(txt);
text->setPos(text_offset, y);
QFontMetricsF fm(text->font());
qreal xe = text_offset + fm.width(txt);
qreal xe = text_offset + fm.horizontalAdvance(txt);
setLine(x, y, xe, y);
}
......
......@@ -44,7 +44,7 @@ qreal LongestDayWidth(const QFontMetricsF &fm)
{
qreal wd = 0;
for (int i = 1; i <= 7; i++) {
qreal w = fm.width(QLocale::system().dayName(i));
qreal w = fm.horizontalAdvance(QLocale::system().dayName(i));
if (w > wd)
wd = w;
}
......@@ -80,7 +80,7 @@ void WeekScene::addCalendar()
delete tmp;
// first add 7 rectangles for each day of the week
xoff = fm.width(QStringLiteral("00:00")) + 10;
xoff = fm.horizontalAdvance(QStringLiteral("00:00")) + 10;
yoff = 2 * fm.height() + 10;
day_width = LongestDayWidth(fm) * 1.5;
hour_height = fm.height() * 1.5;
......@@ -99,7 +99,7 @@ void WeekScene::addCalendar()
QString day = QLocale::system().dayName(i + 1);
// make sure day is centered in the middle of the column
qreal dlen = fm.width(day);
qreal dlen = fm.horizontalAdvance(day);
qreal mid = xoff + day_width * (i + 0.5);
qreal start = mid - dlen * 0.5;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment