Retina support in QML

How to use retina support in QML? How do I choose the right dimensions and the correct resolution for images? The app should work on retina and non-mesh devices.

+3


source to share


1 answer


A very good and comprehensive article on this topic by Morten Johan SΓΆrvig is here .

Qt Quick 2 and Qt Quick Controls work well when it comes to hdpi support. It is important to consider bitmap content and, as the article explains:

As an application developer, you have two options: (ignoring the "do nothing" option)

Replace existing raster content with a high-resolution version
Provide separate high-resolution content

      

The first option is convenient because there is only one version of each resource. However, you may find (or your designer will tell you) that resources such as icons are best for creating a specific resolution. To facilitate this, Qt as the accepted "@ 2x" convention for image Filenames:

foo.png foo@2x.png

High definition content can be provided side by side with the originals. The "@ 2x" version will be loaded automatically as needed using the QML and QIcon image element:

Image {source = "foo.png"} QIcon icon ("foo.png")

(don't forget to set AA_UseHighDpiPixmaps for QIcon)




Another thread on the topic here .

+6


source







All Articles