gpt4 book ai didi

macos - QML 中的视网膜支持

转载 作者:行者123 更新时间:2023-12-01 09:56:20 25 4
gpt4 key购买 nike

如何在 QML 中使用 Retina 支持?如何选择正确的尺寸和正确的图像分辨率?应用需要在 Retina 和非 Retina 设备上运行。

最佳答案

可以找到 Morten Johan Sørvig 关于该主题的一篇非常好的综合文章 here .

Qt Quick 2 和 Qt Quick Controls 在 hdpi 支持方面开箱即用。需要考虑的重要事项是栅格内容,如文章中所述:

As an app 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 since there is only one version of each resource. However, you may find (or your designer will tell you) that resources like icons look best when created for a specific resolution. To facilitate this, Qt as adopted the “@2x” convention for image filenames:

foo.png foo@2x.png

High-resolution content can be provided side-by-side with the originals. The “@2x” version will be loaded automatically when needed by the QML Image element and QIcon:

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

(remember to set AA_UseHighDpiPixmaps for QIcon)


关于该主题的另一个话题 here .

关于macos - QML 中的视网膜支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26165823/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com