Changeset View
Changeset View
Standalone View
Standalone View
lookandfeel/contents/lockscreen/MediaControls.qml
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 41 | PlasmaCore.DataSource { | |||
---|---|---|---|---|---|
90 | } | 90 | } | ||
91 | function playPause(source) { | 91 | function playPause(source) { | ||
92 | startOperation("PlayPause"); | 92 | startOperation("PlayPause"); | ||
93 | } | 93 | } | ||
94 | } | 94 | } | ||
95 | 95 | | |||
96 | Image { | 96 | Image { | ||
97 | id: albumArt | 97 | id: albumArt | ||
98 | Layout.preferredWidth: height | 98 | Layout.preferredWidth: height | ||
davidedmundson: Aha, because of this!
A change in aspect ratio affects the width, which reloads the image… | |||||
99 | Layout.fillHeight: true | 99 | Layout.fillHeight: true | ||
100 | asynchronous: true | 100 | asynchronous: true | ||
101 | fillMode: Image.PreserveAspectFit | 101 | fillMode: Image.PreserveAspectFit | ||
102 | source: mpris2Source.albumArt | 102 | source: mpris2Source.albumArt | ||
103 | sourceSize: Qt.size(width, height) | 103 | sourceSize: Qt.size(paintedWidth, paintedHeight) | ||
We will display at a fixed height assigned from the layout and we adjust our item width to match the aspect ratio ourselves. Therefore, it only really makes sense to set a height on sourceSize
which is what we want Image loads, we resize our width, but we won't re-evaluate this, so no loop. davidedmundson: We will display at a fixed height assigned from the layout and we adjust our item width to… | |||||
104 | visible: status === Image.Loading || status === Image.Ready | 104 | visible: status === Image.Loading || status === Image.Ready | ||
105 | } | 105 | } | ||
106 | 106 | | |||
107 | Item { // spacer | 107 | Item { // spacer | ||
108 | width: units.smallSpacing | 108 | width: units.smallSpacing | ||
109 | height: 1 | 109 | height: 1 | ||
110 | } | 110 | } | ||
111 | 111 | | |||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |
Aha, because of this!
A change in aspect ratio affects the width, which reloads the image, which changes the height, which changes the width
paintedWidth still seems wrong though, it'll only be evaluated after it loads the image at which point the sourceSize is too late.