Bug 435934

Summary: CheckBox neither elides or wraps long text
Product: [Frameworks and Libraries] frameworks-qqc2-desktop-style Reporter: Nate Graham <nate>
Component: generalAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: normal CC: ahiemstra, kde, noahadvs
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=434461
Latest Commit: Version Fixed In: 5.82
Sentry Crash Report:

Description Nate Graham 2021-04-19 18:37:25 UTC
So the text just gets cut off instead.

Trivial test case:


import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2

Item {
    width: 400
    height: 200

    QQC2.CheckBox {
        anchors {
            verticalCenter: parent.verticalCenter
            left: parent.left
            right: parent.right
            margins: 10
        }

        text: "This is a very long piece of text that really should be rewritten to be shorter, but sometimes life just isn't that simple."
    }
}
Comment 1 Nate Graham 2021-04-19 18:40:08 UTC
This is probably caused by using a QQuickStyleItem to render the whole control. So the text gets rendered by that element and fails to be affected by any of the typical text constraints.
Comment 2 Nate Graham 2021-04-19 19:26:12 UTC
RadioButton.qml seems to be implemented with only the radio button itself using a QQuickStyleItem, and the label, mnemonic, and focus indicator are done in QML. Perhaps we need to do the same for CheckBox.qml.
Comment 3 Bug Janitor Service 2021-04-19 21:15:13 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/67
Comment 4 Nate Graham 2021-04-23 14:37:04 UTC
Git commit fd336cfb1125d26b4c75158c8bd412a030932b9b by Nate Graham.
Committed on 19/04/2021 at 20:52.
Pushed by ngraham into branch 'master'.

[CheckBox] Rewrite to be nearly identical to RadioButton

Right now CheckBox uses a QQuickStyleItem to render the whole control.
This breaks its ability to elide long text.

This commit implements it in the same way as RadioButton, which fixes
elision.
FIXED-IN: 5.82

M  +46   -22   org.kde.desktop/CheckBox.qml

https://invent.kde.org/frameworks/qqc2-desktop-style/commit/fd336cfb1125d26b4c75158c8bd412a030932b9b