Summary: | PromptDialog minimum width does not consider subtitle width if its text is set imperatively | ||
---|---|---|---|
Product: | [Frameworks and Libraries] frameworks-kirigami | Reporter: | Plata <plata.hill> |
Component: | general | Assignee: | kdelibs bugs <kdelibs-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | akselmo, kde, kdebugger444, nate, notmart |
Priority: | NOR | ||
Version: | 6.6.0 | ||
Target Milestone: | Not decided | ||
Platform: | Other | ||
OS: | Linux | ||
See Also: | https://bugs.kde.org/show_bug.cgi?id=493663 | ||
Latest Commit: | https://invent.kde.org/frameworks/kirigami/-/commit/6042752ad600ba832b597b79309056895928bee7 | Version Fixed In: | 6.8 |
Sentry Crash Report: | |||
Attachments: |
Telly Skout
PromptDialog with long subtitle Minimal example |
Created attachment 174132 [details]
PromptDialog with long subtitle
I am unable to reproduce this using newest kirigami + kirigami-gallery
This is the prompt dialog code:
```qml
Kirigami.PromptDialog {
id: textPromptDialog
title: "New Folder"
subtitle: "Long subtitle aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
standardButtons: Kirigami.Dialog.NoButton
customFooterActions: [
Kirigami.Action {
text: qsTr("Create Folder")
icon.name: "dialog-ok"
onTriggered: {
showPassiveNotification("Created");
textPromptDialog.close();
}
},
Kirigami.Action {
text: qsTr("Cancel")
icon.name: "dialog-cancel"
onTriggered: {
textPromptDialog.close();
}
}
]
FormCard.FormTextFieldDelegate {
label: qsTr("Folder name:")
leftPadding: 0
rightPadding: 0
}
}
```
It works as expected if the subtitle is known at creation time. Minimal example to reproduce the problem: ```qml Kirigami.PromptDialog { id: textPromptDialog title: "Title" subtitle: "empty" Component.onCompleted: { subtitle = "A long subtitle which should change the width of the PromptDialog" } } ``` Created attachment 174134 [details]
Minimal example
(In reply to Plata from comment #2) > It works as expected if the subtitle is known at creation time. > > Minimal example to reproduce the problem: > ```qml > Kirigami.PromptDialog { > id: textPromptDialog > title: "Title" > subtitle: "empty" > Component.onCompleted: { > subtitle = "A long subtitle which should change the width of the > PromptDialog" > } > } > ``` Thanks, i could repro it now! A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/1628 Git commit e2c12d3b97709d21bf8b5e1e13ed233d2a66983b by Akseli Lahtinen. Committed on 02/10/2024 at 12:46. Pushed by akselmo into branch 'master'. Use TextEdit instead of QQC2.TextArea in SelectableLabel, add context menu to SelectableLabel SelectableLabel wont resize properly when using QQC2.TextArea, likely due to TextArea having it's own resizing and background handling. TextEdit is handled more like a Label is, so it resizes correctly. We just have to manually make it use the proper colors, which was doable with Kirigami. SelectableLabel also has its own, smaller context menu now. M +69 -4 src/controls/SelectableLabel.qml https://invent.kde.org/frameworks/kirigami/-/commit/e2c12d3b97709d21bf8b5e1e13ed233d2a66983b Unfortunately it had to be reverted, reopening this bug A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/1631 Git commit 090042a7e51c21e40b8866b35d5301da3d2b7677 by Akseli Lahtinen. Committed on 03/10/2024 at 12:13. Pushed by akselmo into branch 'master'. Create SelectableText, deprecate SelectableLabel This creates a new SelectableText element that is supposed to replace SelectableLabel due to resizing issues. SelectableLabel uses TextArea, which has features Label does not really need. TextArea also has issues when resizing, since the ImplicitSize resizing is disabled after the initialization. This can cause problems with dynamically changing content, where the TextArea size wont update based on the content. TextEdit has ImplicitSizes as read-only, but it resizes automatically based on the text content. It's wrapped inside a Control. SelectableText also has a simpler context menu, with only Copy and SelectAll buttons. I chose the name SelectableText since this is based on TextEdit, not label. M +4 -0 src/CMakeLists.txt M +1 -1 src/controls/SelectableLabel.qml A +127 -0 src/controls/SelectableText.qml [License: LGPL(v2.0+)] https://invent.kde.org/frameworks/kirigami/-/commit/090042a7e51c21e40b8866b35d5301da3d2b7677 A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/1632 Git commit 692a35c76a28879d0421e1a7dd5006c9a6df210e by Akseli Lahtinen. Committed on 03/10/2024 at 12:47. Pushed by akselmo into branch 'master'. PromptDialog: Port to SelectableText SelectableLabel does not resize correctly due to using TextArea, if the text inside the dialog is dynamically changed. This is because TextArea disables resizing the implicitSizes after initialization. Use the new SelectableText item instead, which works with dynamic resizing. M +1 -1 src/dialogs/PromptDialog.qml https://invent.kde.org/frameworks/kirigami/-/commit/692a35c76a28879d0421e1a7dd5006c9a6df210e Reverted again; re-opening. A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/1635 A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/1636 A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/1638 Git commit 1c54d7d246dbb6c2bf083429f40aee07bcbdcf4a by Akseli Lahtinen. Committed on 10/10/2024 at 09:28. Pushed by akselmo into branch 'master'. Modify SelectableLabel to use TextEdit instead Discussion: https://invent.kde.org/frameworks/kirigami/-/issues/91 SelectableLabel wont resize properly when using QQC2.TextArea, due to TextArea having implicitSize resizing disabled after the initial size. TextEdit is handled more like a Label is, so it resizes correctly. Wrapping it inside Control and exposing the expected properties and signals it should be a drop-in replacement for the old TextArea based SelectableLabel. SelectableLabel also has its own, smaller context menu now. Note that this may be API breaking so we need to do a lot of testing. M +166 -40 src/controls/SelectableLabel.qml https://invent.kde.org/frameworks/kirigami/-/commit/1c54d7d246dbb6c2bf083429f40aee07bcbdcf4a *** Bug 494397 has been marked as a duplicate of this bug. *** This is now fixed by Akseli Lahtinen for Frameworks 6.8 with https://invent.kde.org/frameworks/kirigami/-/commit/07ef78b5aaed379e533c00a72e05b7830e825344 and https://invent.kde.org/frameworks/kirigami/-/commit/6042752ad600ba832b597b79309056895928bee7! |
Created attachment 174024 [details] Telly Skout SUMMARY The PromptDialog width depends on the title only. This looks very weird if the title is short. STEPS TO REPRODUCE Create a PromptDialog with short title but long subtitle. OBSERVED RESULT The width of the PromptDialog is too small. EXPECTED RESULT The width is reasonable. SOFTWARE/OS VERSIONS KDE Plasma Version: 6.1.5 KDE Frameworks Version: 6.6.0 Qt Version: 6.7.2