KateModeMenuList: improve word wrap
ClosedPublic

Authored by nibags on Oct 27 2019, 11:18 AM.

Details

Summary
  • Use QFontMetrics::horizontalAdvance(text) instead of QFontMetrics::boundingRect(text).width(), since it obtains a more precise value over the width of a text.
  • Allow word wrap in section titles.

Diff Detail

Repository
R39 KTextEditor
Branch
improve-word-wrap
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 18416
Build 18434: arc lint + arc unit
nibags created this revision.Oct 27 2019, 11:18 AM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptOct 27 2019, 11:18 AM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
nibags requested review of this revision.Oct 27 2019, 11:18 AM
dhaumann accepted this revision.Oct 27 2019, 4:45 PM

It's hard to review all the pixel changes with no screenshots. It's even unclear to me what problem exactly is fixed at hand. Given it's all your code, I trust you know what you are doing...

This revision is now accepted and ready to land.Oct 27 2019, 4:45 PM

QFontMetrics::boundingRect(text).width() doesn't deliver an exact value of the text width, since I detected that in some translations and some desktop themes the text goes below the scroll bar. This problem doesn't exist with QFontMetrics::horizontalAdvance(text).

For example, in the "Fusion" application style, with Portuguese language, it may be incorrectly seen:
Before / After

Good, fine with me.

Related: Maybe the translation should also be shorter, but the general possible problem persists. Please go ahead.

nibags updated this revision to Diff 68974.Oct 29 2019, 1:04 PM
  • Fix font size/style
nibags updated this revision to Diff 69005.Oct 29 2019, 8:07 PM
  • Restore scroll bar margins
nibags updated this revision to Diff 69022.Oct 30 2019, 5:36 AM
  • Increase margin of list - search bar in Windows
nibags updated this revision to Diff 69150.Nov 1 2019, 9:09 AM
  • Increase the menu size according to the font size, to improve the display

This achieves a better visualization if the user increases the font size in the Plasma preferences.

nibags closed this revision.Nov 1 2019, 10:22 AM