Important: Please read the Qt Code of Conduct -

What is faster, scale, tile or clip image?

  • Hi I have some issues with performance.
    I have > 60 bars(item/rectangle) in a graph that only contains an image that fills the whole bar.
    When I animate the change in height it gets a bit slow.

    Therefore I'm wondering what's the most efficient way of rendering the image, an gradient thats 1px high.
    Tile or scale the image or paint the image bigger than the bar from the beginning and let the bar clip the image?

    Beside this I also have a problem that the image gets 1px higher than the bar at some heights but without images it looks as it should, could this be a bug?


  • I would use a QLinearGradient for this, rather than an image.

    Edit: Oh, qt quick, no clue about that.

  • I understand drawing gradients is slow, and the recommendation is to use images if you can. But couldn't you just try to see what performs better in your use case? My guess would be: tiling, but I am far from sure.

  • I can try to see what feels fastest, but it would have been good to know what is fastest.

    And the problem that the image don't scale to the edges or too long is not only for images, also borders will behave the same. But an empty rectangle will behave exactly as I would expect, anyone got any idea what could be the problem?

Log in to reply