Bug 396450 - KCollapsibleGroupBox: wrong position in parent layout if there is a QLabel with word-wrap
Summary: KCollapsibleGroupBox: wrong position in parent layout if there is a QLabel wi...
Status: CONFIRMED
Alias: None
Product: frameworks-kwidgetsaddons
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 5.47.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Christoph Feck
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-12 20:37 UTC by Elvis Angelaccio
Modified: 2021-08-25 23:15 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Self-contained test case for the issue (1.17 KB, application/zip)
2018-07-12 20:37 UTC, Elvis Angelaccio
Details
Expected layout (22.04 KB, image/png)
2018-07-12 20:39 UTC, Elvis Angelaccio
Details
Actual layout (22.89 KB, image/png)
2018-07-12 20:40 UTC, Elvis Angelaccio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elvis Angelaccio 2018-07-12 20:37:22 UTC
Created attachment 113904 [details]
Self-contained test case for the issue

If a KCollapsibleGroupBox contains a QLabel with word-wrapping enabled, it will be wrongly positioned in its parent layout.

This issue seems to be called by the setFocusPolicy() call in overrideFocusPolicyOf().

Not sure whether the bug is in KCollapsibleGroupBox or in Qt.
Comment 1 Elvis Angelaccio 2018-07-12 20:39:17 UTC
Created attachment 113905 [details]
Expected layout
Comment 2 Elvis Angelaccio 2018-07-12 20:40:01 UTC
Created attachment 113906 [details]
Actual layout
Comment 3 Nate Graham 2018-07-13 16:12:09 UTC
Patch available: https://phabricator.kde.org/D13570
Comment 4 Elvis Angelaccio 2018-08-04 15:07:23 UTC
Git commit e8519d6af2ad2b9c342a270a915e613bc88dff47 by Elvis Angelaccio.
Committed on 04/08/2018 at 15:02.
Pushed by elvisangelaccio into branch 'master'.

Add workaround for labels with word-wrapping

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.

Test Plan: Apply the patch, then run `kcollapsiblegroupboxtest` with/without the workaround compiled in.

Reviewers: davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13570

M  +12   -0    src/kcollapsiblegroupbox.cpp
M  +6    -0    tests/kcollapsiblegroupboxtest.cpp

https://commits.kde.org/kwidgetsaddons/e8519d6af2ad2b9c342a270a915e613bc88dff47
Comment 5 Ahmad Samir 2021-08-25 23:15:36 UTC
I tested this, and with and without the above commit the issue seems to be fixed.