Commit 45702f22 authored by Albert Astals Cid's avatar Albert Astals Cid

Port deprecated QFontMetrics::width -> horizontalAdvance

parent 78d983ee
Pipeline #36047 passed with stage
in 17 minutes and 34 seconds
......@@ -880,7 +880,7 @@ void XpsHandler::processGlyph(XpsRenderNode &node)
if (advanceWidth > 0.0) {
originAdvance.rx() += advanceWidth;
} else {
originAdvance.rx() += metrics.width(thisChar);
originAdvance.rx() += metrics.horizontalAdvance(thisChar);
}
}
// qCWarning(OkularXpsDebug) << "Glyphs: " << atts.value("Fill") << ", " << atts.value("FontUri");
......@@ -1607,7 +1607,7 @@ Okular::TextPage *XpsPage::textPage()
int lastWidth = 0;
for (int i = 0; i < text.length(); i++) {
int width = metrics.width(text, i + 1);
const int width = metrics.horizontalAdvance(text, i + 1);
Okular::NormalizedRect *rect =
new Okular::NormalizedRect((origin.x() + lastWidth) / m_pageSize.width(), (origin.y() - metrics.height()) / m_pageSize.height(), (origin.x() + width) / m_pageSize.width(), origin.y() / m_pageSize.height());
......
......@@ -285,7 +285,7 @@ void MiniBar::slotToolBarIconSizeChanged()
void MiniBar::resizeForPage(int pages)
{
int numberWidth = 10 + fontMetrics().width(QString::number(pages));
const int numberWidth = 10 + fontMetrics().horizontalAdvance(QString::number(pages));
m_pageNumberEdit->setMinimumWidth(numberWidth);
m_pageNumberEdit->setMaximumWidth(2 * numberWidth);
m_pageLabelEdit->setMinimumWidth(numberWidth);
......
......@@ -184,7 +184,7 @@ PresentationWidget::PresentationWidget(QWidget *parent, Okular::Document *doc, D
QFontMetrics fm(m_pagesEdit->font());
QStyleOptionFrame option;
option.initFrom(m_pagesEdit);
m_pagesEdit->setMaximumWidth(fm.width(QString::number(m_document->pages())) + 2 * style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &option, m_pagesEdit) +
m_pagesEdit->setMaximumWidth(fm.horizontalAdvance(QString::number(m_document->pages())) + 2 * style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &option, m_pagesEdit) +
4); // the 4 comes from 2*horizontalMargin, horizontalMargin being a define in qlineedit.cpp
QIntValidator *validator = new QIntValidator(1, m_document->pages(), m_pagesEdit);
m_pagesEdit->setValidator(validator);
......
Markdown is supported
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