Strange Qt issue with transforms



  • So, I've got a couple windows painting (background, layer1, layer2). B is a parent of L1 is a parent of L2. Everything is cool.

    Now, I apply a transform in the painting of L2 (I want the full window content, but smaller - think like a picture-in-picture presentation). This transform does a .tranlate(...) and .scale(...). Now, suddenly, L2 is painting below B and L1. :sideways_owl:

    Any ideas?

    edit: Forgot to mention, these 3 objects are all custom drawing QWidget derived things.


  • Banned

    @dcon Z-fighting?



  • @Gustav Something like that. I tried adding a specific raise(), but that didn't do anything.


  • Banned

    @dcon I meant that the Z position shifted after matrix transforms. I don't know if it's a thing in Qt but it would explain the behavior. Can you try assigning it back to 0?



  • @Gustav said in Strange Qt issue with transforms:

    @dcon I meant that the Z position shifted after matrix transforms. I don't know if it's a thing in Qt but it would explain the behavior. Can you try assigning it back to 0?

    I never touch Z. The translate function just takes an X and Y. And scaling is applied as X and Y also.

    I should play around with this is see which call is causing this... that'll take a while because of a meeting that is about to start...



  • :headdesk: I copied some previously working code (from a couple years ago). Part of that set a clipping region (which I forgot about when working on the transform). I got that wrong and was actually excluding the area I wanted - no z-ordering involved.


Log in to reply