summaryrefslogtreecommitdiff
path: root/kde-plasma/plasma-pa/files/plasma-pa-5.27.3-improve-DeviceListItem-sizing.patch
blob: b37d08a745fd42901c08dc9c9e48bb565bc818b2 (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From b6715dc950ab5019542f2f7a77e9f2aa4afab9dc Mon Sep 17 00:00:00 2001
From: Oliver Beard <olib141@outlook.com>
Date: Tue, 21 Mar 2023 20:19:38 +0000
Subject: [PATCH] kcm/DeviceListItem: Set width for comboboxes, with correctly
 sized popup

This commit sets a preferred width for the port/profile comboboxes, so that they appear consistent. The full names are visible by opening the combobox, as the popup is now sized to show the full name. It is also ensured that the popup is positioned correctly to not go off the page when wide.


(cherry picked from commit 82a276183fac1ca79d7fe2a14d3f19e9a96ba830)
---
 src/kcm/package/contents/ui/DeviceListItem.qml | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/kcm/package/contents/ui/DeviceListItem.qml b/src/kcm/package/contents/ui/DeviceListItem.qml
index 714884c2..09feea71 100644
--- a/src/kcm/package/contents/ui/DeviceListItem.qml
+++ b/src/kcm/package/contents/ui/DeviceListItem.qml
@@ -94,7 +94,7 @@ ColumnLayout {
 
             readonly property var ports: Ports
 
-            Layout.minimumWidth: Kirigami.Units.gridUnit * 10
+            Layout.preferredWidth: Kirigami.Units.gridUnit * 10
             visible: portBox.count > 1
 
             onModelChanged: currentIndex = ActivePortIndex
@@ -119,6 +119,13 @@ ColumnLayout {
                 }
                 model = items;
             }
+
+            // Ensure the popup is sufficiently wide to list *full* device names
+            // and is correctly positioned to not go off the page
+            popup.width: Math.max(implicitWidth, width)
+            popup.leftMargin: delegate.ListView.view.Layout.leftMargin
+            popup.rightMargin: delegate.ListView.view.Layout.rightMargin
+            popup.x: mirrored ? 0 : width - popup.width
         }
 
         Label {
@@ -133,7 +140,7 @@ ColumnLayout {
 
             readonly property var card: paCardModel.data(paCardModel.indexOfCardNumber(CardIndex), paCardModel.role("PulseObject"))
 
-            Layout.minimumWidth: Kirigami.Units.gridUnit * 12
+            Layout.preferredWidth: Kirigami.Units.gridUnit * 12
             visible: profileBox.count > 1
             textRole: "description"
 
@@ -141,6 +148,13 @@ ColumnLayout {
             currentIndex: card ? model.indexOf(card.profiles[card.activeProfileIndex]) : -1
 
             onActivated: index => card.activeProfileIndex = card.profiles.indexOf(model[index])
+
+            // Ensure the popup is sufficiently wide to list *full* device names
+            // and is correctly positioned to not go off the page
+            popup.width: Math.max(implicitWidth, width)
+            popup.leftMargin: delegate.ListView.view.Layout.leftMargin
+            popup.rightMargin: delegate.ListView.view.Layout.rightMargin
+            popup.x: mirrored ? 0 : width - popup.width
         }
     }
 
-- 
GitLab