Add workaround for labels with word-wrapping
ClosedPublic

Authored by elvisangelaccio on Jun 16 2018, 4:26 PM.

Details

Summary

It's not clear why, but the combination of a word-wrapped QLabel with
the setFocusPolicy() call in overrideFocusPolicyOf() seems to break
the positioning of the groupbox in its parent layout.

Until we understand where the bug is and how to fix it, we can toggle
the groupbox twice when we detect that a QLabel with word-wrapping
enabled has been added as child. Not clear why (again), but this fixes
(or at least hides) the issue.

CCBUG: 396450

Test Plan

Apply the patch, then run kcollapsiblegroupboxtest with/without the workaround compiled in.

Diff Detail

Repository
R236 KWidgetsAddons
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Restricted Application added a project: Frameworks. · View Herald TranscriptJun 16 2018, 4:26 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
elvisangelaccio requested review of this revision.Jun 16 2018, 4:26 PM

Ping.

If no one has objections, I'll push it after the next tag.

cfeck added a comment.Jul 8 2018, 2:27 PM

Could you add a bug number so that people reading the code can decide if/when the workaround can get removed?

elvisangelaccio planned changes to this revision.Jul 8 2018, 9:13 PM

There is no bugreport, I'll have to file one.

While working on a minimal test case I realized that QBoxLayout::addStretch() might also be involved. Needs more investigation.

elvisangelaccio edited the summary of this revision. (Show Details)Jul 12 2018, 8:40 PM
  • Added bug report
anthonyfieroni added inline comments.
src/kcollapsiblegroupbox.cpp
307–308

Did you know why it should be called twice? Does one later toggle invoke will fix it?

cfeck accepted this revision.Aug 2 2018, 7:32 PM

Please commit until we find a better solution.

This revision is now accepted and ready to land.Aug 2 2018, 7:32 PM
This revision was automatically updated to reflect the committed changes.