applets/notifications: Optimize thumbnail strip
See individual commits
Original commit message(s)
- applets/notifications: Fix maximum size of ActionContainer in thumbnail strip
We don't want to Layout.fillWidth on the container since the buttons should be aligned to the right. This was done by the empty Item with fillWidth set to push the container to the right. However, when it contained an item with fillWidth (inline-reply text field) that would overflow.
Set an explicit maximum size to fix this. The item is replaced by an arbitrary stretch factor to avoid uneven spacing (the item will cause spacing to the left) when the actions fill the entire width.
- applets/notifications: Use PreviewJob::generated (QImage) for thumbnail
This skips the conversion of the thumbnail image to a QPixmap.
The drag pixmap still needs to be a pixmap but that's not a hot path and can then convert it on demand.
- applets/notifications: Drop unused ratio calculation
It's not used anymore.
- applets/notifications: Use existing thumbnail image for blurred background
Rather than rendering the pixmap twice, just use the thumbnail as source for the blur effect.
This shuffles some code around so that the pixmap item has the size of the pixmap so the blur will stretch it (achieving the same effect as before) and also moves the buttons outside the thumbnail so they're not included in the blur.
Reason for the change
Makes it more efficient. Ported it from PreviewJob::gotPreview to PrviewJob::generated so we skip the conversion of QImage to QPixmap, then I found that the blur effect rendered the pixmap twice, and then while doing some more testing I found a bug (I haven’t encuntered inline preview + URL in the wild but still better to have it working correctly) and and unused property.
Test plan
Used frameworks/knotifications!207 (merged) to test the preview,
- preview still shows fine
- the blur behind it looks the same as before
- action buttons in the thumbnail appear aligned properly
- drag pixmap for the thumbnail still works fine
Screenshots or screen recordings
cc @meven because he did thumbnail work in KIO/Dolphin lately

