Priority: P2: Important
Affects Version/s: 6.0.1
Component/s: Widgets: GraphicsView
Commits:269fdef53d98386b714bf6852a1f214e9159faa1 (qt/tqtc-qtbase/dev) 3dca0aaf09c7859b30adbe9e95da6840a6906d4f (qt/qtbase/6.1)
This is a very recent issue, and I wasn't having this issue at all before, so I'm assuming it's strictly relevant to a recent version.
In short, QGraphicsItem::setZValue does practically nothing.
I have to reorder how I initialize my graphics items. This however, won't be enough to solve every issue efficiently.
Here's a basic amount of code:
.cpp file (inherits QGraphicsView):
The above code keeps everything in proper order.
However, if I reorder how I initialize things, then the appearance is entirely different, in spite of the fact that I've defined their zValues. That is, whatever is defined first, shows at the back, and whatever is defined last, shows up at the front, regardless of the z-value set.
Even if It set the background brush after initializing the SheetRect, the SheetRect will move behind the the Dense6Pattern. If the SelectionRect is initialized before the SheetRect, then the SelectionRect moves behind the SheetRect.
Again, this wasn't always the case. Setting the z-value did the trick for a while. I'd just prefer the issue be "refixed".
|For Gerrit Dashboard: QTBUG-81316|
|336715,1||Fix z-value of QGraphicsItems being ignored during draw||6.0||qt/qtbase||Status: NEW||+2||0|
|336180,8||Fix z-value of QGraphicsItems being ignored during draw||dev||qt/qtbase||Status: MERGED||+2||0|
|336716,2||Fix z-value of QGraphicsItems being ignored during draw||6.1||qt/qtbase||Status: MERGED||+2||0|