Changeset View
Changeset View
Standalone View
Standalone View
applets/taskmanager/package/contents/ui/ToolTipInstance.qml
Show First 20 Lines • Show All 315 Lines • ▼ Show 20 Line(s) | 309 | RowLayout { | |||
---|---|---|---|---|---|
316 | spacing: 0 | 316 | spacing: 0 | ||
317 | enabled: canControl | 317 | enabled: canControl | ||
318 | 318 | | |||
319 | ColumnLayout { | 319 | ColumnLayout { | ||
320 | Layout.leftMargin: 2 | 320 | Layout.leftMargin: 2 | ||
321 | Layout.fillWidth: true | 321 | Layout.fillWidth: true | ||
322 | spacing: 0 | 322 | spacing: 0 | ||
323 | 323 | | |||
324 | PlasmaComponents.Label { | 324 | TextWrapper { | ||
325 | id: songTextWrapper | ||||
326 | | ||||
broulik: I think this item could use a better name, maybe `TextHoverScroller` or something like that? | |||||
325 | Layout.fillWidth: true | 327 | Layout.fillWidth: true | ||
328 | Layout.preferredHeight: songText.contentHeight | ||||
329 | | ||||
330 | textItem: songText | ||||
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
```… | |||||
331 | | ||||
332 | PlasmaComponents.Label { | ||||
333 | id: songText | ||||
334 | width: parent.width | ||||
335 | height: contentHeight | ||||
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… | |||||
326 | lineHeight: 1 | 336 | lineHeight: 1 | ||
327 | maximumLineCount: artistText.visible? 1 : 2 | 337 | maximumLineCount: artistText.visible? 1 : 2 | ||
328 | wrapMode: artistText.visible? Text.NoWrap : Text.Wrap | 338 | wrapMode: Text.NoWrap | ||
329 | elide: Text.ElideRight | 339 | elide: songTextWrapper.longHovering? Text.ElideNone : Text.ElideRight | ||
broulik: Coding style: space before `?` | |||||
330 | text: track || "" | 340 | text: track || "" | ||
331 | } | 341 | } | ||
342 | } | ||||
343 | | ||||
344 | TextWrapper { | ||||
345 | id: artistTextWrapper | ||||
346 | | ||||
347 | Layout.fillWidth: true | ||||
348 | Layout.preferredHeight: artistText.visible? artistText.contentHeight : 0 | ||||
349 | | ||||
350 | textItem: artistText | ||||
332 | 351 | | |||
333 | PlasmaExtras.DescriptiveLabel { | 352 | PlasmaExtras.DescriptiveLabel { | ||
334 | id: artistText | 353 | id: artistText | ||
335 | Layout.fillWidth: true | 354 | width: parent.width | ||
355 | height: contentHeight | ||||
336 | wrapMode: Text.NoWrap | 356 | wrapMode: Text.NoWrap | ||
337 | lineHeight: 1 | 357 | lineHeight: 1 | ||
338 | elide: Text.ElideRight | 358 | elide: artistTextWrapper.longHovering? Text.ElideNone : Text.ElideRight | ||
339 | text: artist || "" | 359 | text: artist || "" | ||
340 | visible: text != "" | 360 | visible: text != "" | ||
341 | font.pointSize: theme.smallestFont.pointSize | 361 | font.pointSize: theme.smallestFont.pointSize | ||
342 | } | 362 | } | ||
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… | |||||
343 | } | 363 | } | ||
364 | } | ||||
344 | 365 | | |||
345 | PlasmaComponents.ToolButton { | 366 | PlasmaComponents.ToolButton { | ||
346 | enabled: canGoBack | 367 | enabled: canGoBack | ||
347 | iconSource: LayoutMirroring.enabled ? "media-skip-forward" : "media-skip-backward" | 368 | iconSource: LayoutMirroring.enabled ? "media-skip-forward" : "media-skip-backward" | ||
348 | onClicked: mpris2Source.goPrevious(mprisSourceName) | 369 | onClicked: mpris2Source.goPrevious(mprisSourceName) | ||
349 | } | 370 | } | ||
350 | 371 | | |||
351 | PlasmaComponents.ToolButton { | 372 | PlasmaComponents.ToolButton { | ||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |
I think this item could use a better name, maybe TextHoverScroller or something like that?