From: Arjen Hiemstra Date: Mon, 7 Apr 2025 15:26:11 +0000 (+0200) Subject: [PATCH] controls: Fix link activation for text of InlineMessage X-Git-Tag: archive/raspbian/6.13.0-2+rpi1^2~8 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e287537a027ffb7e2edeb9384ad933785e25d554;p=kf6-kirigami.git [PATCH] controls: Fix link activation for text of InlineMessage Rather than stretching both the label and toolbar across the entire inline message, use implicit width for both, unless either would become larger than the InlineMessage width. Most importantly, since the toolbar only takes space that is not used by the text, this avoids links in the text not working correctly. BUG: 500578 Gbp-Pq: Name upstream_82abc769_controls-Fix-link-activation-for-text-of-InlineMessage.patch --- diff --git a/src/controls/templates/InlineMessage.qml b/src/controls/templates/InlineMessage.qml index 6781c43..ecf3b66 100644 --- a/src/controls/templates/InlineMessage.qml +++ b/src/controls/templates/InlineMessage.qml @@ -216,13 +216,9 @@ T.Control { Accessible.ignored: true - readonly property real remainingWidth: width - ( - icon.width - + label.anchors.leftMargin + label.implicitWidth + label.anchors.rightMargin - + (root.showCloseButton ? closeButton.width : 0) - ) + readonly property real fixedContentWidth: icon.width + Kirigami.Units.smallSpacing * 3 + (root.showCloseButton ? closeButton.width + Kirigami.Units.smallSpacing : 0) + readonly property real remainingWidth: width - fixedContentWidth - label.implicitWidth readonly property bool multiline: remainingWidth <= 0 || atBottom - readonly property bool atBottom: (root.actions.length > 0) && (label.lineCount > 1 || actionsLayout.implicitWidth > remainingWidth) Kirigami.Icon { @@ -302,11 +298,11 @@ T.Control { anchors { left: icon.right leftMargin: Kirigami.Units.largeSpacing - right: root.showCloseButton ? closeButton.left : parent.right - rightMargin: root.showCloseButton ? Kirigami.Units.smallSpacing : 0 top: parent.top } + width: Math.min(parent.width - parent.fixedContentWidth, implicitWidth) + color: Kirigami.Theme.textColor wrapMode: Text.WordWrap @@ -358,12 +354,13 @@ T.Control { alignment: Qt.AlignRight anchors { - left: parent.left top: contentLayout.atBottom ? label.bottom : parent.top topMargin: contentLayout.atBottom ? Kirigami.Units.largeSpacing : 0 right: (!contentLayout.atBottom && root.showCloseButton) ? closeButton.left : parent.right rightMargin: !contentLayout.atBottom && root.showCloseButton ? Kirigami.Units.smallSpacing : 0 } + + width: Math.min(implicitWidth, parent.width) } QQC2.ToolButton {