Fix an incorrect text bounding rectangle calculation inside the sidebar

Authored by AndreyYashkin on Aug 7 2019, 9:31 PM.



Now fontBoundaries always has smaller width than boundingRect from

void QPainter::drawText(const QRect &rectangle, int flags, const QString &text, QRect *boundingRect = nullptr)

which is required to enclose the whole text. The difference is only several pixels, but sometimes it can cause visual problems. You can see the sidebar without and with this patch in Russian language with Noto Sans 10pt font on a picture below.

Now the first and the last symbols are fully visible.

Diff Detail

R223 Okular
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
AndreyYashkin requested review of this revision.Aug 7 2019, 9:31 PM
AndreyYashkin created this revision.
aacid accepted this revision.Aug 7 2019, 10:26 PM
aacid added a subscriber: aacid.

meh, the two boundingRect returning different rects (even if documented) is sad.

I've pushed a different fix using QRect() as first param, saves us the need of creating a huge QRect and AFAIK it does the same than you wanted .

This revision is now accepted and ready to land.Aug 7 2019, 10:26 PM
This revision was automatically updated to reflect the committed changes.