On Fri, Sep 23, 2016 at 11:26:31AM +0200, Jean-Marc Lasgouttes wrote:
> 
> Actually, most of the used of getPixmap are like
>   QIcon(getPixmap(...)).pixmap(somesize);
> 
> It looks like a strange code path to me. What does getPixmap return in the
> case of a svg? Some rasterized version of the svg? Then how does it help to
> go through a QIcon and then back to QPixmap?

I am not really an expert, but QIcon takes care of loading, scaling and
post-processing of the image. Moreover, QIcon may contain multiple images
with different sizes (most probably some common used sizes). So, when you
request a certain size, it probably gives you a scaled version of the nearest
precomputed size. This may explain the better quality.

> It would look better to me to have a getIcon function which returns a QIcon,
> so that we can directly render the svg at the right size. Or did I
> misunderstand how this works?

Seemingly, QIcon already provides multiple images with different sizes, such
that the best fit is chosen depending on the size to be used. But, I repeat,
I am not really an expert and mine are speculations rather than facts.

-- 
Enrico

Reply via email to