Bug 435934 - CheckBox neither elides or wraps long text
Summary: CheckBox neither elides or wraps long text
Status: RESOLVED FIXED
Alias: None
Product: frameworks-qqc2-desktop-style
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-19 18:37 UTC by Nate Graham
Modified: 2021-04-23 14:37 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.82
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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