In QML (Qt Quick), “opaque” fills almost always outperform “transparent” ones, because transparency forces extra GPU work (blending, sorting, broken batching, etc.). Here’s a quick rundown:
Opaque (solid) shapes
• Implemented as QSGGeometryNode
• Can use early‐Z/depth tests and simple “replace” blending
• Can be batched with other opaque items for fewer draw calls
→ Very fast, minimal GPU overhead
Transparent shapes (any alpha < 1.0, including fully transparent)
• Turn into QSGOpacityNode/QSGRenderNode
• Require sorting back‐to‐front and alpha blending per pixel
• Break batching with opaque siblings
→ More draw calls, more pixel‐shader work, more GPU state changes
Practical tips
If you really want no background, don’t declare a transparent Rectangle at all.
• Either omit the Rectangle, or set visible: false on it
• If you need a “hit area” without drawing, use a MouseArea with hoverEnabled: true
When you do need transparency (e.g. translucent panel), minimize the # of semi-transparent items.
• Consider flattening multiple layers into one offscreen Layer (with layer.enabled: true)
• Or pre-compose in an image/texture so QML only does one blended quad
Always profile with the QML Profiler / QSG_INFO=1 to see how many nodes, layers, and draw calls you have.
Bottom line: if you don’t actually see the shape, just omit it. And anytime you can use fully opaque colors, you’ll get better performance in your Qt Quick scene.
User
what if even if i have inner objecst
Assistant
When you put any QML Item (or Rectangle) with a non-opaque fill (alpha < 1.0 or transparent) around a bunch of children, Qt Quick has to:
Render that group of children into an off-screen buffer
Blend that buffer back into the rest of the scene
That off-screen pass (“opacity layer”) is exactly what kills batching and adds extra GPU work, regardless of whether your “background” is semi-transparent or fully transparent.
—
Why “transparent” still costs you
Case
Draw calls
Batching
Offscreen layer?
Opaque Rectangle
1
✓ (can merge with siblings)
no
Semi-transparent (<100% alpha)
≥1
✗
yes
color: “transparent” (alpha = 0)
≥1
✗
yes
Even if alpha = 0, Qt Quick doesn’t special-case “I don’t need a background at all”—it still creates that opacity node, and you lose batching for all child items.
—
What to do instead
Use an Item (no background geometry) as your container
qml
Item {
// no `color:` → no geometry, no draw call, no offscreen buffer
width: 300; height: 200
Rectangle { … } // child #1
Text { … } // child #2
}
If you only need the hit area, swap Rectangle + transparent for a MouseArea (hoverEnabled if you need mouse-over).
If you must group & blend a bunch of semi-transparent children, explicitly create a layer:
qml
Item {
layer.enabled: true
layer.smooth: true // or false, depending on quality needs
children: [ … your stuff … ]
}
This at least gives you control over when & how that offscreen pass happens.
Profile with QT_QUICK_PROFILER, QSG_INFO=1 and watch for QSGOpacityNode or QSGRenderLayerNode in your scene graph.
—
TL;DR
• “transparent” ≠ “no-draw”—it still forces an offscreen opacity pass.
• If you don’t actually need a colored background, use plain Item.
• When you group translucent children, use an explicit layer so you know you’re paying for it.