port away from deprecated API from QFontMetricsF

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2022-05-22 22:26:34 +02:00 committed by Matthieu Gallien
parent d035c26be5
commit 20ee506b71

View file

@ -32,7 +32,7 @@ void PostfixLineEdit::setPostfix(const QString &postfix)
_postfix = postfix;
QFontMetricsF fm(font());
QMargins tm = textMargins();
tm.setRight(tm.right() + qRound(fm.width(_postfix)) + verticalMargin);
tm.setRight(tm.right() + qRound(fm.horizontalAdvance(_postfix)) + verticalMargin);
setTextMargins(tm);
}
@ -63,7 +63,7 @@ void PostfixLineEdit::paintEvent(QPaintEvent *pe)
//
p.setPen(palette().color(QPalette::Disabled, QPalette::Text));
QFontMetricsF fm(font());
int start = rect().right() - qRound(fm.width(_postfix));
int start = rect().right() - qRound(fm.horizontalAdvance(_postfix));
QStyleOptionFrame panel;
initStyleOption(&panel);
QRect r = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);