Been following the examples found here and have an issue where semi-transparent items are always drawn on top of opaque items no matter their order in QML or how the z property is set.
With no OpenGL Item, everything works as expected
import QtQuick 2.14
import TestScene 1.0
Item {
width: 160
height: 120
/*
TestScene {
// draw checkered pattern in OpenGL
}
*/
Rectangle {
id: rect1
x: 32
y: 32
width: 32
height: 32
color: Qt.rgba(1, 0, 0, 0.5)
}
Rectangle {
id: rect2
x: 32+16
y: 32+16
width: 32
height: 32
color: Qt.rgba(0, 0, 1, 1)
}
}
desired

When uncommenting the TestScene item
result

This happens even if rect2 is set before rect1 and regardless of the z property of either item.
The OpenGL code in C++ is pretty much as the Squircle example, and this is on Windows 10 and Qt 5.14.
Just curious why this happens and if it can be prevented or is it just a limitation of drawing OpenGL under QML.