Commit 5d4ddb53 authored by Allan Sandfeld Jensen's avatar Allan Sandfeld Jensen

Fix build after deprecated QFontMetrics::width()

Summary: It was deprecated for not reporting the actual width but horizontal advance. Use the actual bounding width instead and don't claim to support future deprecations.

Reviewers: mlaurent

Reviewed By: mlaurent

Subscribers: #kde_pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D11113
parent 860e908a
......@@ -53,7 +53,7 @@ find_package(KF5Prison ${Prison_MIN_VERSION} CONFIG REQUIRED)
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050a00)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
if(BUILD_TESTING)
......
......@@ -68,10 +68,10 @@ public:
font.setStyle(QFont::StyleItalic);
QFontMetrics metrics(font);
for (const QString &description : qAsConst(mDescriptions)) {
mMaxDescriptionWidth = qMax(mMaxDescriptionWidth, metrics.width(description));
mMaxDescriptionWidth = qMax(mMaxDescriptionWidth, metrics.boundingRect(description).width());
}
mMaxDescriptionWidth += 3;
mMaxDescriptionWidth += 2;
}
int maximumDescriptionWidth() const
......@@ -211,7 +211,7 @@ bool DisplayNameEditWidget::eventFilter(QObject *object, QEvent *event)
QFontMetrics metrics(mView->font());
const int viewCount(mView->count());
for (int i = 0; i < viewCount; ++i) {
maxWidth = qMax(maxWidth, metrics.width(mView->itemText(i)));
maxWidth = qMax(maxWidth, metrics.boundingRect(mView->itemText(i)).width());
}
// resize it to show the complete content
......
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