Changeset View
Changeset View
Standalone View
Standalone View
applets/taskmanager/package/contents/ui/ToolTipInstance.qml
Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Line(s) | 244 | RowLayout { | |||
---|---|---|---|---|---|
246 | 246 | | |||
247 | visible: hasPlayer | 247 | visible: hasPlayer | ||
248 | enabled: canControl | 248 | enabled: canControl | ||
249 | 249 | | |||
250 | ColumnLayout { | 250 | ColumnLayout { | ||
251 | Layout.fillWidth: true | 251 | Layout.fillWidth: true | ||
252 | spacing: 0 | 252 | spacing: 0 | ||
253 | 253 | | |||
254 | PlasmaComponents3.Label { | 254 | ScrollableTextWrapper { | ||
255 | id: songTextWrapper | ||||
256 | | ||||
broulik: I think this item could use a better name, maybe `TextHoverScroller` or something like that? | |||||
255 | Layout.fillWidth: true | 257 | Layout.fillWidth: true | ||
258 | Layout.preferredHeight: songText.height | ||||
259 | | ||||
QML trick: Define the property as default property and then you can just write TextWrapper { Text { ... } } broulik: QML trick: Define the property as `default property` and then you can just write
```… | |||||
260 | PlasmaComponents3.Label { | ||||
261 | id: songText | ||||
262 | parent: songTextWrapper | ||||
263 | width: parent.width | ||||
264 | height: undefined | ||||
I think you can assign undefined to reset it to its default value. Plasma Label annoyingly overwrites its height broulik: I think you can assign `undefined` to reset it to its default value. Plasma `Label` annoyingly… | |||||
256 | lineHeight: 1 | 265 | lineHeight: 1 | ||
257 | maximumLineCount: artistText.visible? 1 : 2 | 266 | maximumLineCount: artistText.visible? 1 : 2 | ||
258 | wrapMode: artistText.visible? Text.NoWrap : Text.Wrap | 267 | wrapMode: Text.NoWrap | ||
259 | elide: Text.ElideRight | 268 | elide: parent.state ? Text.ElideNone : Text.ElideRight | ||
broulik: Coding style: space before `?` | |||||
260 | text: track || "" | 269 | text: track || "" | ||
261 | } | 270 | } | ||
271 | } | ||||
272 | | ||||
273 | ScrollableTextWrapper { | ||||
274 | id: artistTextWrapper | ||||
275 | | ||||
276 | Layout.fillWidth: true | ||||
277 | Layout.preferredHeight: artistText.height | ||||
278 | visible: artistText.text !== "" | ||||
262 | 279 | | |||
263 | PlasmaExtras.DescriptiveLabel { | 280 | PlasmaExtras.DescriptiveLabel { | ||
264 | id: artistText | 281 | id: artistText | ||
265 | Layout.fillWidth: true | 282 | parent: artistTextWrapper | ||
283 | width: parent.width | ||||
284 | height: undefined | ||||
266 | wrapMode: Text.NoWrap | 285 | wrapMode: Text.NoWrap | ||
267 | lineHeight: 1 | 286 | lineHeight: 1 | ||
268 | elide: Text.ElideRight | 287 | elide: parent.state ? Text.ElideNone : Text.ElideRight | ||
269 | text: artist || "" | 288 | text: artist || "" | ||
270 | visible: text != "" | | |||
271 | font.pointSize: theme.smallestFont.pointSize | 289 | font.pointSize: theme.smallestFont.pointSize | ||
272 | } | 290 | } | ||
Generally try to avoid binding to visible as that updates recursively. Since this contains the label below, you can probably just make this visible: artistText.text !== "" and then remove the visible statement below broulik: Generally try to avoid binding to `visible` as that updates recursively. Since this contains… | |||||
273 | } | 291 | } | ||
292 | } | ||||
274 | 293 | | |||
275 | PlasmaComponents3.ToolButton { | 294 | PlasmaComponents3.ToolButton { | ||
276 | enabled: canGoBack | 295 | enabled: canGoBack | ||
277 | icon.name: LayoutMirroring.enabled ? "media-skip-forward" : "media-skip-backward" | 296 | icon.name: LayoutMirroring.enabled ? "media-skip-forward" : "media-skip-backward" | ||
278 | icon.height: units.iconSizes.small | 297 | icon.height: units.iconSizes.small | ||
279 | icon.width: units.iconSizes.small | 298 | icon.width: units.iconSizes.small | ||
280 | onClicked: mpris2Source.goPrevious(mprisSourceName) | 299 | onClicked: mpris2Source.goPrevious(mprisSourceName) | ||
281 | } | 300 | } | ||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |
I think this item could use a better name, maybe TextHoverScroller or something like that?