File: upstream_2c6cd90f_controls-Improve-calculation-of-InlineMessage-implicit-height.patch

package info (click to toggle)
kf6-kirigami 6.13.0-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,268 kB
  • sloc: cpp: 12,214; xml: 97; sh: 53; makefile: 7
file content (47 lines) | stat: -rw-r--r-- 2,248 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From 2c6cd90f785c40d6a3f72dcd824c6199634ba737 Mon Sep 17 00:00:00 2001
From: Arjen Hiemstra <ahiemstra@heimr.nl>
Date: Tue, 8 Apr 2025 11:10:47 +0200
Subject: [PATCH] controls: Improve calculation of InlineMessage implicit
 height

If the text isn't long enough to wrap into mulitple lines, but we have
many or large actions such that the actions are still put below the
text, the actions and close button would overlap because the close
button is not accounted for. To fix that, always anchor the actions at
the bottom and calculate a more proper implicit height for the entire
inline message that accounts for close button height if it is visible.
---
 src/controls/templates/InlineMessage.qml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/controls/templates/InlineMessage.qml b/src/controls/templates/InlineMessage.qml
index ecf3b6655..f8a868891 100644
--- a/src/controls/templates/InlineMessage.qml
+++ b/src/controls/templates/InlineMessage.qml
@@ -207,10 +207,11 @@ T.Control {
         }
 
         implicitHeight: {
+            let maximumTopHeight = Math.max(label.implicitHeight, icon.implicitHeight, (root.showCloseButton ? closeButton.implicitHeight : 0))
             if (atBottom) {
-                return label.implicitHeight + actionsLayout.implicitHeight + actionsLayout.anchors.topMargin
+                return maximumTopHeight + actionsLayout.implicitHeight + Kirigami.Units.smallSpacing
             } else {
-                return Math.max(icon.implicitHeight, label.implicitHeight, closeButton.implicitHeight, actionsLayout.implicitHeight)
+                return Math.max(maximumTopHeight, actionsLayout.implicitHeight)
             }
         }
 
@@ -354,8 +355,7 @@ T.Control {
             alignment: Qt.AlignRight
 
             anchors {
-                top: contentLayout.atBottom ? label.bottom : parent.top
-                topMargin: contentLayout.atBottom ? Kirigami.Units.largeSpacing : 0
+                bottom: parent.bottom
                 right: (!contentLayout.atBottom && root.showCloseButton) ? closeButton.left : parent.right
                 rightMargin: !contentLayout.atBottom && root.showCloseButton ? Kirigami.Units.smallSpacing : 0
             }
-- 
GitLab