Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/ListItemBase.qml
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 36 | PlasmaComponents.ListItem { | |||
---|---|---|---|---|---|
48 | 48 | | |||
49 | ListView.delayRemove: dragArea.dragActive | 49 | ListView.delayRemove: dragArea.dragActive | ||
50 | 50 | | |||
51 | Item { | 51 | Item { | ||
52 | width: parent.width | 52 | width: parent.width | ||
53 | height: column.height | 53 | height: column.height | ||
54 | 54 | | |||
55 | RowLayout { | 55 | RowLayout { | ||
56 | id: rowLayout | 56 | id: controlsRow | ||
57 | spacing: units.smallSpacing | ||||
57 | anchors.left: parent.left | 58 | anchors.left: parent.left | ||
58 | anchors.right: parent.right | 59 | anchors.right: parent.right | ||
59 | 60 | | |||
60 | PlasmaCore.IconItem { | 61 | PlasmaCore.IconItem { | ||
61 | id: clientIcon | 62 | id: clientIcon | ||
62 | Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter | 63 | Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter | ||
63 | Layout.preferredHeight: column.height * 0.75 | 64 | Layout.preferredHeight: column.height * 0.75 | ||
64 | Layout.preferredWidth: Layout.preferredHeight | 65 | Layout.preferredWidth: Layout.preferredHeight | ||
Show All 35 Lines | 98 | onClicked: { | |||
100 | } | 101 | } | ||
101 | } | 102 | } | ||
102 | } | 103 | } | ||
103 | } | 104 | } | ||
104 | } | 105 | } | ||
105 | 106 | | |||
106 | ColumnLayout { | 107 | ColumnLayout { | ||
107 | id: column | 108 | id: column | ||
108 | spacing: 0 | 109 | spacing: 0 | ||
gvgeo: With testing I found 5 pixel spacing. But couldn't trace where it comes from, maybe padding… | |||||
109 | 110 | | |||
110 | RowLayout { | 111 | RowLayout { | ||
111 | Layout.minimumHeight: contextMenuButton.height | 112 | Layout.minimumHeight: contextMenuButton.implicitHeight | ||
112 | 113 | | |||
113 | PlasmaComponents3.RadioButton { | 114 | PlasmaComponents3.RadioButton { | ||
114 | id: defaultButton | 115 | id: defaultButton | ||
116 | // Maximum width of the button need to match the text. Empty area must not change the default device. | ||||
This feels wrong. The radio button shouldn't need a maximum width set on it. ngraham: This feels wrong. The radio button shouldn't need a maximum width set on it. | |||||
Replace this line with Layout.fillWidth: true. This works because soloLabel and defaultButton will never be visible at the same time; when soloLabel isn't visible, then the radio button's label will be the item that's filling the width. ngraham: Replace this line with `Layout.fillWidth: true`. This works because `soloLabel` and… | |||||
117 | Layout.maximumWidth: controlsRow.width - Layout.leftMargin - Layout.rightMargin | ||||
118 | - (contextMenuButton.visible ? contextMenuButton.implicitWidth + units.smallSpacing * 2 : 0) | ||||
115 | Layout.leftMargin: LayoutMirroring.enabled ? 0 : Math.round((muteButton.width - defaultButton.indicator.width) / 2) | 119 | Layout.leftMargin: LayoutMirroring.enabled ? 0 : Math.round((muteButton.width - defaultButton.indicator.width) / 2) | ||
116 | Layout.rightMargin: LayoutMirroring.enabled ? Math.round((muteButton.width - defaultButton.indicator.width) / 2) : 0 | 120 | Layout.rightMargin: LayoutMirroring.enabled ? Math.round((muteButton.width - defaultButton.indicator.width) / 2) : 0 | ||
117 | spacing: units.smallSpacing + Math.round((muteButton.width - defaultButton.indicator.width) / 2) | 121 | spacing: units.smallSpacing + Math.round((muteButton.width - defaultButton.indicator.width) / 2) | ||
118 | checked: PulseObject.default ? PulseObject.default : false | 122 | checked: PulseObject.default ? PulseObject.default : false | ||
119 | visible: (type == "sink" && sinkView.model.count > 1) || (type == "source" && sourceView.model.count > 1) | 123 | visible: (type == "sink" && sinkView.model.count > 1) || (type == "source" && sourceView.model.count > 1) | ||
120 | onClicked: PulseObject.default = true; | 124 | onClicked: PulseObject.default = true; | ||
121 | } | 125 | } | ||
122 | 126 | | |||
123 | Label { | 127 | PlasmaComponents3.Label { | ||
gvgeo: Is this all it needs to fix text color bug? | |||||
124 | id: soloLabel | 128 | id: soloLabel | ||
129 | Layout.fillWidth: true | ||||
Instead of giving this label a maximum width, maybe you could just have it be the item in the layout that gets Layout.fillWidth: true and then remove the Item below it ngraham: Instead of giving this label a maximum width, maybe you could just have it be the item in the… | |||||
gvgeo: This will also solve the complexity of this patch. | |||||
125 | text: defaultButton.text | 130 | text: defaultButton.text | ||
126 | visible: !defaultButton.visible | 131 | visible: !defaultButton.visible | ||
127 | elide: Text.ElideRight | 132 | elide: Text.ElideRight | ||
128 | } | 133 | } | ||
129 | 134 | | |||
130 | Item { | 135 | Item { | ||
131 | Layout.fillWidth: true | 136 | Layout.fillWidth: true | ||
137 | visible: contextMenuButton.visble | ||||
132 | } | 138 | } | ||
133 | 139 | | |||
134 | SmallToolButton { | 140 | SmallToolButton { | ||
135 | id: contextMenuButton | 141 | id: contextMenuButton | ||
136 | icon: "application-menu" | 142 | icon: "application-menu" | ||
137 | checkable: true | 143 | checkable: true | ||
138 | onClicked: contextMenu.show() | 144 | onClicked: contextMenu.show() | ||
139 | tooltip: i18n("Show additional options for %1", defaultButton.text) | 145 | tooltip: i18n("Show additional options for %1", defaultButton.text) | ||
▲ Show 20 Lines • Show All 259 Lines • Show Last 20 Lines |
With testing I found 5 pixel spacing. But couldn't trace where it comes from, maybe padding around items?. Used smallSpacing instead to avoid another magic number.