Fix build after deprecated QFontMetrics::width()
ClosedPublic

Authored by carewolf on Mar 7 2018, 11:20 AM.

Details

Summary

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

Diff Detail

Repository
R91 PIM: Sieve Handling Library
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
carewolf created this revision.Mar 7 2018, 11:20 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptMar 7 2018, 11:20 AM
Restricted Application added a subscriber: KDE PIM. · View Herald Transcript
carewolf requested review of this revision.Mar 7 2018, 11:20 AM

What is the problem here ?
I build all with qt5.11 yesterday and it build fine.

Could you paste error ?
So you changed api between qt5.11beta1 and qt5.11 branch ?
thanks.

No it is just QFontMetrics::width() is marked deprecated, and that doesn't change the Qt API and wouldn't be a problem if it wasn't that you are telling Qt to omit all deprecated API also things deprecated in the future, which is a bad idea.

So there is two solution. Port it to new method with a qt check
or use add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x051000) as it builds fine until qt5.10 I don't want to readd deprecated method now as we know that it compiles fine with qt5.10 and previous

But I prefere first solution so it will avoid to me to port it in the future :)

mlaurent requested changes to this revision.Mar 7 2018, 1:58 PM
This revision now requires changes to proceed.Mar 7 2018, 1:58 PM

Why not both? I just did the change to the define because it was less work and still fixing something wrong.

carewolf updated this revision to Diff 28961.Mar 7 2018, 5:02 PM

Based on review feedback

carewolf retitled this revision from Fix building with 5.11 to Fix build after deprecated QFontMetrics::width().Mar 7 2018, 5:03 PM
carewolf edited the summary of this revision. (Show Details)
mlaurent accepted this revision.Mar 8 2018, 5:43 AM

Thanks :)

This revision is now accepted and ready to land.Mar 8 2018, 5:43 AM
This revision was automatically updated to reflect the committed changes.