Fix build after deprecated QFontMetrics::width()

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



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

R91 PIM: Sieve Handling Library
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
carewolf created this revision.Wed, Mar 7, 11:20 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptWed, Mar 7, 11:20 AM
Restricted Application added a subscriber: KDE PIM. · View Herald Transcript
carewolf requested review of this revision.Wed, Mar 7, 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 ?

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.Wed, Mar 7, 1:58 PM
This revision now requires changes to proceed.Wed, Mar 7, 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.Wed, Mar 7, 5:02 PM

Based on review feedback

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

Thanks :)

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