Bug 399686

Summary: Cannot use an IconItem as a source or maskSource for anything
Product: [Frameworks and Libraries] libplasma Reporter: Nate Graham <nate>
Component: libplasmaquickAssignee: Marco Martin <notmart>
Status: RESOLVED NOT A BUG    
Severity: normal CC: kde
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Nate Graham 2018-10-12 00:06:46 UTC
I'm trying to use a PlasmaCore.IconItem as the MaskSource for a MaskedBlur. Instead of the icon's visible alpha channel acting as a mask as desired, the whole thing appears opaque so there is no mask. The same happens more trivially using just `source:`

For example:

Image {
    id: imageFromIcon
    source: icon
    anchors.fill: icon
}
PlasmaCore.IconItem {
    id: icon
    visible: false
    icon.source: "preferences-desktop-color"
}

imageFromIcon will be invisible rather than a QML Image representation of the icon.

This is currently blocking the blur component of https://phabricator.kde.org/D16031
Comment 1 David Edmundson 2018-10-12 01:18:28 UTC
Relevant API to do it natively is
QSGTextureProvider *QQuickItem::textureProvider() const

Never done it before, but it doesn't seem too difficult. We generate QSGTextures elsewhere in that same code; we just need to make this interim class.

But in any case, what you're looking for is ShaderEffectSource which will work for any item(s).

Not as performant as the above as it effectively renders then captures the content, but it's fine for small cases.
Comment 2 Nate Graham 2018-10-12 02:34:41 UTC
ShaderEffectSource was just what I needed, thanks!

ShaderEffectSource {
    id: renderedIcon
    visible: false
    sourceItem: icon
}