Closed DrewNaylor closed 1 year ago
For now I need to wait for qt5compat to be fixed for PySide6 in Qt 6.4, as I can't import it otherwise.
Ended up copying and pasting the first example into its own project, then modifying it so it uses the image I'm trying to use as an example wallpaper, and it appears to make the buttons see-through as expected. The main issue is that text isn't showing up because it makes everything transparent.
This might be important if I notice that image quality is reduced with the OpacityMask: https://stackoverflow.com/questions/61925379/qml-opacitymask-reduces-image-quality
Might have to try to figure out how to modify this chromakey shader so it can be used with QML/Qt instead of webgl and such: https://stackoverflow.com/a/60778766 Main page for this answer: https://stackoverflow.com/questions/60767805/chromakey-glsl-shader-with-transparent-background
Also, this repo may prove useful if I need to manually port it to Qt, as the original shader was a ShaderToy one, and it may be similar or something: https://github.com/MichaelStraube/shaders
If anyone else is reading this, I figured it out with a ShaderEffectSource that uses the image and then sets the sourceRect to be based on the image but using offsets from the tiles based on their X- and Y-values, as well as their width and height. Basically like punching out a hole just for tiles. This replaces the solid color background rectangle for tiles, but doesn't really have antialiasing that much, as far as it appears. Pressing down also doesn't keep the internal image the same, so the preview size matches the button instead of "cropping" the view as expected. You can find my implementation in ./RetiledStyles/TileBackgroundShaderEffectSource.qml
.
It would require tweaking and I'm not sure about how opaque tiles would be handled alongside transparent ones, but item layers with OpacityMask appear to be how it can be done: https://stackoverflow.com/questions/66604044/qml-layer-element-reveals-element-above-it-when-they-overlap
While looking for that, I also found a page describing how to do a 20% opacity black rectangle (in Qt 4.x, so hopefully it can be ported to 6.x somewhat easily), which would be useful for making things easier to see (which is what Microsoft did for background images if there was a lot of stuff on top) if the user wants it: https://stackoverflow.com/a/26998032 Not sure how this would apply to the tile background, maybe it would just be above the background but behind the tiles or something.