Important: Please read the Qt Code of Conduct -

QQuickPaintedItem gradients do not align

  • Hello.
    I'm currently creating a custom item for QML. In order to do so I use a QQuickPaintedItem. To draw the background of my item I want to use 2 linear gradients and one radial to get a half circle open to the right. Please see the attached image for reference.

    The problem I have is that although the base points for the gradients are the same (All start at half hight and end at the outside border), the bottom of the radial and bottom linear gradients do not line up at all heights. At many heights I get an offset at the bottom like seen in the image. The top works fine though everytime and at any resolution.

    Can anybody tell me if I do something wrong or if this a bug? I tried a lot of different things (like offsets if height is odd/even) but I didn't find a way, where it works with all resolutions.

    I'm using Qt 5.8 on Windows 10. The QQuickPaintItem is using QImage render target.

    The code of a small sample program can be found here.


Log in to reply